Changeset 6963
- Timestamp:
- 12/20/07 17:06:30 (9 months ago)
- Files:
-
- django/trunk/django/db/backends/oracle/base.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/backends/oracle/base.py
r6905 r6963 414 414 415 415 def _cursor(self, settings): 416 cursor = None 416 417 if not self._valid_connection(): 417 418 if len(settings.DATABASE_HOST.strip()) == 0: … … 423 424 conn_string = "%s/%s@%s" % (settings.DATABASE_USER, settings.DATABASE_PASSWORD, settings.DATABASE_NAME) 424 425 self.connection = Database.connect(conn_string, **self.options) 426 cursor = FormatStylePlaceholderCursor(self.connection) 427 # Set oracle date to ansi date format. This only needs to execute 428 # once when we create a new connection. 429 cursor.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD' " 430 "NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF'") 425 431 try: 426 432 self.oracle_version = int(self.connection.version.split('.')[0]) 427 433 except ValueError: 428 434 pass 429 cursor = FormatStylePlaceholderCursor(self.connection) 435 if not cursor: 436 cursor = FormatStylePlaceholderCursor(self.connection) 430 437 # Default arraysize of 1 is highly sub-optimal. 431 438 cursor.arraysize = 100 432 # Set oracle date to ansi date format.433 cursor.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD'")434 cursor.execute("ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF'")435 439 return cursor 436 440
