summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/query.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-10-23 17:41:55 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-10-23 17:44:52 -0400
commitf035b6e0a41238d092ea2ddd10fdd5de298ff789 (patch)
tree76c2c9b9e4b63964847126aba054de19cfc485f7 /lib/sqlalchemy/orm/query.py
parent382cd56772efd92a9fe5ce46623029a04163c8cf (diff)
downloadsqlalchemy-f035b6e0a41238d092ea2ddd10fdd5de298ff789.tar.gz
An overhaul of expression handling for special symbols particularly
with conjunctions, e.g. ``None`` :func:`.expression.null` :func:`.expression.true` :func:`.expression.false`, including consistency in rendering NULL in conjunctions, "short-circuiting" of :func:`.and_` and :func:`.or_` expressions which contain boolean constants, and rendering of boolean constants and expressions as compared to "1" or "0" for backends that don't feature ``true``/``false`` constants. [ticket:2804]
Diffstat (limited to 'lib/sqlalchemy/orm/query.py')
-rw-r--r--lib/sqlalchemy/orm/query.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index 17fb32663..3df12c0a7 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -2865,8 +2865,9 @@ class Query(object):
if adapter:
single_crit = adapter.traverse(single_crit)
single_crit = self._adapt_clause(single_crit, False, False)
- context.whereclause = sql.and_(context.whereclause,
- single_crit)
+ context.whereclause = sql.and_(
+ sql.True_._ifnone(context.whereclause),
+ single_crit)
def __str__(self):
return str(self._compile_context().statement)