mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
queryset-refactor: Fixed disjunctions of empty result sets. Refs #6074.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6868 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
57a4b882ae
commit
8e6126fbc2
@ -42,6 +42,7 @@ class WhereNode(tree.Node):
|
||||
return None, []
|
||||
result = []
|
||||
result_params = []
|
||||
empty = True
|
||||
for child in node.children:
|
||||
if hasattr(child, 'as_sql'):
|
||||
sql, params = child.as_sql(qn=qn)
|
||||
@ -60,10 +61,15 @@ class WhereNode(tree.Node):
|
||||
if self.connector == AND and not node.negated:
|
||||
# We can bail out early in this particular case (only).
|
||||
raise
|
||||
sql = None
|
||||
elif node.negated:
|
||||
empty = False
|
||||
continue
|
||||
empty = False
|
||||
if sql:
|
||||
result.append(format % sql)
|
||||
result_params.extend(params)
|
||||
if empty:
|
||||
raise EmptyResultSet
|
||||
conn = ' %s ' % node.connector
|
||||
return conn.join(result), result_params
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user