summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/operators.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/sql/operators.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/sql/operators.py')
-rw-r--r--lib/sqlalchemy/sql/operators.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py
index 128442158..e9b904d7c 100644
--- a/lib/sqlalchemy/sql/operators.py
+++ b/lib/sqlalchemy/sql/operators.py
@@ -654,6 +654,12 @@ def exists():
raise NotImplementedError()
+def istrue(a):
+ raise NotImplementedError()
+
+def isfalse(a):
+ raise NotImplementedError()
+
def is_(a, b):
return a.is_(b)
@@ -779,6 +785,7 @@ parenthesize (a op b).
"""
+_asbool = util.symbol('_asbool', canonical=-10)
_smallest = util.symbol('_smallest', canonical=-100)
_largest = util.symbol('_largest', canonical=100)
@@ -816,12 +823,15 @@ _PRECEDENCE = {
between_op: 5,
distinct_op: 5,
inv: 5,
+ istrue: 5,
+ isfalse: 5,
and_: 3,
or_: 2,
comma_op: -1,
collate: 7,
as_: -1,
exists: 0,
+ _asbool: -10,
_smallest: _smallest,
_largest: _largest
}