mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
queryset-refactor: Different database backends return different empty sequences
when fetchmany() is exhausted. This change allows for that. Fixed #6807. Nice debugging from tpherndon. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7283 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6b974720a9
commit
98b5667a06
@ -50,6 +50,7 @@ class BaseDatabaseFeatures(object):
|
|||||||
supports_tablespaces = False
|
supports_tablespaces = False
|
||||||
uses_case_insensitive_names = False
|
uses_case_insensitive_names = False
|
||||||
uses_custom_queryset = False
|
uses_custom_queryset = False
|
||||||
|
empty_fetchmany_value = []
|
||||||
|
|
||||||
class BaseDatabaseOperations(object):
|
class BaseDatabaseOperations(object):
|
||||||
"""
|
"""
|
||||||
|
@ -61,6 +61,7 @@ server_version_re = re.compile(r'(\d{1,2})\.(\d{1,2})\.(\d{1,2})')
|
|||||||
class DatabaseFeatures(BaseDatabaseFeatures):
|
class DatabaseFeatures(BaseDatabaseFeatures):
|
||||||
autoindexes_primary_keys = False
|
autoindexes_primary_keys = False
|
||||||
inline_fk_references = False
|
inline_fk_references = False
|
||||||
|
empty_fetchmany_value = ()
|
||||||
|
|
||||||
class DatabaseOperations(BaseDatabaseOperations):
|
class DatabaseOperations(BaseDatabaseOperations):
|
||||||
def date_extract_sql(self, lookup_type, field_name):
|
def date_extract_sql(self, lookup_type, field_name):
|
||||||
|
@ -66,6 +66,7 @@ class MysqlDebugWrapper:
|
|||||||
class DatabaseFeatures(BaseDatabaseFeatures):
|
class DatabaseFeatures(BaseDatabaseFeatures):
|
||||||
autoindexes_primary_keys = False
|
autoindexes_primary_keys = False
|
||||||
inline_fk_references = False
|
inline_fk_references = False
|
||||||
|
empty_fetchmany_value = ()
|
||||||
|
|
||||||
class DatabaseOperations(BaseDatabaseOperations):
|
class DatabaseOperations(BaseDatabaseOperations):
|
||||||
def date_extract_sql(self, lookup_type, field_name):
|
def date_extract_sql(self, lookup_type, field_name):
|
||||||
|
@ -1330,7 +1330,8 @@ class Query(object):
|
|||||||
if result_type == SINGLE:
|
if result_type == SINGLE:
|
||||||
return cursor.fetchone()
|
return cursor.fetchone()
|
||||||
# The MULTI case.
|
# The MULTI case.
|
||||||
return iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), [])
|
return iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
|
||||||
|
self.connection.features.empty_fetchmany_value)
|
||||||
|
|
||||||
def get_order_dir(field, default='ASC'):
|
def get_order_dir(field, default='ASC'):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user