summaryrefslogtreecommitdiff
path: root/django/db/models/sql/where.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/sql/where.py')
-rw-r--r--django/db/models/sql/where.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py
index 2a342d417a..024b995c99 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -16,10 +16,12 @@ from django.utils.six.moves import xrange
from django.utils import timezone
from django.utils import tree
+
# Connection types
AND = 'AND'
OR = 'OR'
+
class EmptyShortCircuit(Exception):
"""
Internal exception used to indicate that a "matches nothing" node should be
@@ -27,6 +29,7 @@ class EmptyShortCircuit(Exception):
"""
pass
+
class WhereNode(tree.Node):
"""
Used to represent the SQL where-clause.
@@ -175,7 +178,7 @@ class WhereNode(tree.Node):
"""
lvalue, lookup_type, value_annotation, params_or_value = child
field_internal_type = lvalue.field.get_internal_type() if lvalue.field else None
-
+
if isinstance(lvalue, Constraint):
try:
lvalue, params = lvalue.process(lookup_type, params_or_value, connection)
@@ -304,14 +307,15 @@ class WhereNode(tree.Node):
clone.children.append(child)
return clone
-class EmptyWhere(WhereNode):
+class EmptyWhere(WhereNode):
def add(self, data, connector):
return
def as_sql(self, qn=None, connection=None):
raise EmptyResultSet
+
class EverythingNode(object):
"""
A node that matches everything.
@@ -385,6 +389,7 @@ class Constraint(object):
new.alias, new.col, new.field = change_map[self.alias], self.col, self.field
return new
+
class SubqueryConstraint(object):
def __init__(self, alias, columns, targets, query_object):
self.alias = alias