Ticket #7732: oracle_pool.6.diff
File oracle_pool.6.diff, 3.9 KB (added by , 15 years ago) |
---|
-
django/db/backends/oracle/base.py
257 257 258 258 def __init__(self, *args, **kwargs): 259 259 super(DatabaseWrapper, self).__init__(*args, **kwargs) 260 260 from django.conf import settings 261 self.settings = settings 261 262 self.features = DatabaseFeatures() 262 263 self.ops = DatabaseOperations() 263 264 self.client = DatabaseClient() … … 266 267 self.validation = BaseDatabaseValidation() 267 268 268 269 # Fetch connection pool settings 269 opts = se lf.settings_dict['DATABASE_OPTIONS']270 opts = settings.get('DATABASE_OPTIONS') 270 271 if not isinstance(opts, dict): 271 272 # Insurance against foolish users... 272 273 opts = {} … … 279 280 280 281 def _get_pool (self): 281 282 if not hasattr (self.__class__, '_pool'): 282 settings _dict = self.settings_dict283 settings = self.settings 283 284 Database.OPT_Threading = 1 284 if len(settings _dict['DATABASE_HOST'].strip()) == 0:285 settings _dict['DATABASE_HOST']= 'localhost'286 if len(settings _dict['DATABASE_PORT'].strip()) != 0:287 dsn = Database.makedsn(settings _dict['DATABASE_HOST'],288 int(settings _dict['DATABASE_PORT']),289 settings _dict['DATABASE_NAME'])290 p = Database.SessionPool(settings _dict['DATABASE_USER'],291 settings _dict['DATABASE_PASSWORD'],285 if len(settings.DATABASE_HOST.strip()) == 0: 286 settings.DATABASE_HOST = 'localhost' 287 if len(settings.DATABASE_PORT.strip()) != 0: 288 dsn = Database.makedsn(settings.DATABASE_HOST, 289 int(settings.DATABASE_PORT), 290 settings.DATABASE_NAME) 291 p = Database.SessionPool(settings.DATABASE_USER, 292 settings.DATABASE_PASSWORD, 292 293 dsn, 293 294 self._pool_settings['SESSION_POOL_MIN'], 294 295 self._pool_settings['SESSION_POOL_MAX'], 295 296 self._pool_settings['SESSION_POOL_INCREMENT'], 296 297 threaded = True) 297 298 else: 298 p = Database.SessionPool(settings _dict['DATABASE_USER'],299 settings _dict['DATABASE_PASSWORD'],300 settings _dict['DATABASE_NAME'],299 p = Database.SessionPool(settings.DATABASE_USER, 300 settings.DATABASE_PASSWORD, 301 settings.DATABASE_NAME, 301 302 self._pool_settings['SESSION_POOL_MIN'], 302 303 self._pool_settings['SESSION_POOL_MAX'], 303 304 self._pool_settings['SESSION_POOL_INCREMENT'], … … 360 361 pass 361 362 return cursor 362 363 363 def _cursor(self ):364 def _cursor(self, settings): 364 365 cursor = None 365 366 if not self._valid_connection(): 366 367 if self._use_pool and self.pool is not None: 367 368 self.connection = self.pool.acquire() 368 369 else: 369 self.connection = Database.connect(self._connect_string( ),370 **self.settings_dict['DATABASE_OPTIONS'])370 self.connection = Database.connect(self._connect_string(settings), 371 getattr(settings, 'DATABASE_OPTIONS')) 371 372 cursor = self._init_oracle_settings(self.connection) 372 373 try: 373 374 self.connection.stmtcachesize = 20