Changeset 4843
- Timestamp:
- 03/28/07 17:20:22 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/boulder-oracle-sprint/django/db/backends/oracle/base.py
r4776 r4843 46 46 cursor = FormatStylePlaceholderCursor(self.connection) 47 47 # default arraysize of 1 is highly sub-optimal 48 cursor.arraysize = 25648 cursor.arraysize = 100 49 49 # set oracle date to ansi date format 50 50 cursor.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD'") … … 234 234 235 235 from django.db import backend, connection 236 from django.db.models.query import EmptyResultSet 236 from django.db.models.query import EmptyResultSet, GET_ITERATOR_CHUNK_SIZE 237 237 238 238 class OracleQuerySet(DefaultQuerySet): … … 286 286 yield field 287 287 288 for unresolved_row in cursor: 289 row = list(resolve_cols(unresolved_row)) 290 if fill_cache: 291 obj, index_end = get_cached_row(self.model, row, 0) 292 else: 293 obj = self.model(*row[:index_end]) 294 for i, k in enumerate(extra_select): 295 setattr(obj, k[0], row[index_end+i]) 296 yield obj 288 while 1: 289 rows = cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE) 290 if not rows: 291 raise StopIteration 292 for row in rows: 293 row = list(resolve_cols(row)) 294 if fill_cache: 295 obj, index_end = get_cached_row(klass=self.model, row=row, 296 index_start=0, max_depth=self._max_related_depth) 297 else: 298 obj = self.model(*row[:index_end]) 299 for i, k in enumerate(extra_select): 300 setattr(obj, k[0], row[index_end+i]) 301 yield obj 302 297 303 298 304 def _get_sql_clause(self, get_full_query=False): django/branches/boulder-oracle-sprint/django/db/backends/oracle/introspection.py
r4279 r4843 7 7 "Returns a list of table names in the current database." 8 8 cursor.execute("SELECT TABLE_NAME FROM USER_TABLES") 9 return [row[0].upper() for row in cursor ]9 return [row[0].upper() for row in cursor.fetchall()] 10 10 11 11 def get_table_description(cursor, table_name): … … 13 13 cursor.execute("SELECT * FROM %s WHERE ROWNUM < 2" % quote_name(table_name)) 14 14 return cursor.description 15 15 16 16 def _name_to_index(cursor, table_name): 17 17 """ … … 25 25 Returns a dictionary of {field_index: (field_index_other_table, other_table)} 26 26 representing all relationships to the given table. Indexes are 0-based. 27 """ 27 """ 28 28 cursor.execute(""" 29 29 SELECT ta.column_id - 1, tb.table_name, tb.column_id - 1 … … 84 84 indexes[row[0]] = {'primary_key': row[1], 'unique': row[2]} 85 85 return indexes 86 86 87 87 88 88 # Maps type codes to Django Field types. django/branches/boulder-oracle-sprint/django/db/backends/util.py
r4840 r4843 33 33 'time': "%.3f" % (stop - start), 34 34 }) 35 36 def __iter__(self):37 return self.cursor.__iter__()38 35 39 36 def __getattr__(self, attr):
