mirror of
https://github.com/django/django.git
synced 2025-06-05 19:49:13 +00:00
Fixed Oracle backend failure in test suite for modeltests.queries. Item.objects.all()[0:0] was optimizing out the limits clause and returning all rows.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8069 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f5801e5fd1
commit
96d141dfda
@ -87,9 +87,11 @@ def query_class(QueryClass, Database):
|
||||
If 'with_limits' is False, any limit/offset information is not
|
||||
included in the query.
|
||||
"""
|
||||
|
||||
# The `do_offset` flag indicates whether we need to construct
|
||||
# the SQL needed to use limit/offset w/Oracle.
|
||||
do_offset = with_limits and (self.high_mark or self.low_mark)
|
||||
do_offset = with_limits and (self.high_mark is not None
|
||||
or self.low_mark)
|
||||
|
||||
# If no offsets, just return the result of the base class
|
||||
# `as_sql`.
|
||||
@ -126,7 +128,7 @@ def query_class(QueryClass, Database):
|
||||
|
||||
# Place WHERE condition on `rn` for the desired range.
|
||||
result.append('WHERE rn > %d' % self.low_mark)
|
||||
if self.high_mark:
|
||||
if self.high_mark is not None:
|
||||
result.append('AND rn <= %d' % self.high_mark)
|
||||
|
||||
# Returning the SQL w/params.
|
||||
@ -148,4 +150,3 @@ def query_class(QueryClass, Database):
|
||||
|
||||
_classes[QueryClass] = OracleQuery
|
||||
return OracleQuery
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user