summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Charette <charettes@users.noreply.github.com>2019-11-18 04:45:24 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-11-18 10:45:24 +0100
commit3ca77e2b843a264ad74fcd7b92141de1ddf5a4cb (patch)
tree148b7dd71482373518055f8e88c8d40e1e1855bc
parent8685e764efd2957085762d9249e07794d9a58dcb (diff)
Replaced QueryWrapper single usage with RawSQL.
-rw-r--r--django/db/models/query_utils.py14
-rw-r--r--django/db/models/sql/compiler.py6
2 files changed, 2 insertions, 18 deletions
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py
index 189fb4fa44..a9abf8d025 100644
--- a/django/db/models/query_utils.py
+++ b/django/db/models/query_utils.py
@@ -30,20 +30,6 @@ def subclasses(cls):
yield from subclasses(subclass)
-class QueryWrapper:
- """
- A type that indicates the contents are an SQL fragment and the associate
- parameters. Can be used to pass opaque data to a where-clause, for example.
- """
- contains_aggregate = False
-
- def __init__(self, sql, params):
- self.data = sql, list(params)
-
- def as_sql(self, compiler=None, connection=None):
- return self.data
-
-
class Q(tree.Node):
"""
Encapsulate filters as objects that can then be combined logically (using
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index 638813333d..b3d0e0ac2d 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -7,9 +7,7 @@ from django.core.exceptions import EmptyResultSet, FieldError
from django.db.models.constants import LOOKUP_SEP
from django.db.models.expressions import OrderBy, Random, RawSQL, Ref, Value
from django.db.models.functions import Cast
-from django.db.models.query_utils import (
- Q, QueryWrapper, select_related_descend,
-)
+from django.db.models.query_utils import Q, select_related_descend
from django.db.models.sql.constants import (
CURSOR, GET_ITERATOR_CHUNK_SIZE, MULTI, NO_RESULTS, ORDER_DIR, SINGLE,
)
@@ -1139,7 +1137,7 @@ class SQLCompiler:
lhs_sql, lhs_params = self.compile(select_col)
rhs = '%s.%s' % (qn(alias), qn2(columns[index]))
self.query.where.add(
- QueryWrapper('%s = %s' % (lhs_sql, rhs), lhs_params), 'AND')
+ RawSQL('%s = %s' % (lhs_sql, rhs), lhs_params), 'AND')
sql, params = self.as_sql()
return 'EXISTS (%s)' % sql, params