Ticket #6807: iterator_sentinel.patch

File iterator_sentinel.patch, 2.1 KB (added by tpherndon, 7 years ago)

Sets iterator sentinel to proper sentinel type for sqlite and mysql backends.

  • django/db/models/sql/query.py

     
    13301330        if result_type == SINGLE:
    13311331            return cursor.fetchone()
    13321332        # The MULTI case.
     1333        if self.connection.features.uses_tuple_iterator_sentinel:
     1334            return iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), ())
    13331335        return iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), [])
    13341336
    13351337def get_order_dir(field, default='ASC'):
  • django/db/backends/mysql/base.py

     
    6161class DatabaseFeatures(BaseDatabaseFeatures):
    6262    autoindexes_primary_keys = False
    6363    inline_fk_references = False
     64    uses_tuple_iterator_sentinel = True
    6465
    6566class DatabaseOperations(BaseDatabaseOperations):
    6667    def date_extract_sql(self, lookup_type, field_name):
     
    127128            return sql
    128129        else:
    129130            return []
    130 
     131           
    131132class DatabaseWrapper(BaseDatabaseWrapper):
    132133    features = DatabaseFeatures()
    133134    ops = DatabaseOperations()
  • django/db/backends/__init__.py

     
    5050    supports_tablespaces = False
    5151    uses_case_insensitive_names = False
    5252    uses_custom_queryset = False
     53    uses_tuple_iterator_sentinel = False
    5354
    5455class BaseDatabaseOperations(object):
    5556    """
     
    126127        contain a '%s' placeholder for the value being searched against.
    127128        """
    128129        raise NotImplementedError('Full-text search is not implemented for this database backend')
    129 
     130       
    130131    def last_executed_query(self, cursor, sql, params):
    131132        """
    132133        Returns a string of the query last executed by the given cursor, with
Back to Top