summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-07-06 12:35:45 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-07-06 12:35:45 -0400
commit5b8738b7e390471bd31b9ece90d0a3fd7653d859 (patch)
tree81b520b5ef6dd004f61112441d8b0c5bd76270a5 /lib/sqlalchemy/sql/util.py
parent138774b234457bde1af522062be74403d71ea7d9 (diff)
downloadsqlalchemy-5b8738b7e390471bd31b9ece90d0a3fd7653d859.tar.gz
- The join condition produced by with_parent
as well as when using a "dynamic" relationship against a parent will generate unique bindparams, rather than incorrectly repeating the same bindparam. [ticket:2207]. Also in 0.6.9.
Diffstat (limited to 'lib/sqlalchemy/sql/util.py')
-rw-r--r--lib/sqlalchemy/sql/util.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py
index f003a9691..77c3e45ec 100644
--- a/lib/sqlalchemy/sql/util.py
+++ b/lib/sqlalchemy/sql/util.py
@@ -194,13 +194,15 @@ def adapt_criterion_to_null(crit, nulls):
"""given criterion containing bind params, convert selected elements to IS NULL."""
def visit_binary(binary):
- if isinstance(binary.left, expression._BindParamClause) and binary.left.key in nulls:
+ if isinstance(binary.left, expression._BindParamClause) \
+ and binary.left._identifying_key in nulls:
# reverse order if the NULL is on the left side
binary.left = binary.right
binary.right = expression.null()
binary.operator = operators.is_
binary.negate = operators.isnot
- elif isinstance(binary.right, expression._BindParamClause) and binary.right.key in nulls:
+ elif isinstance(binary.right, expression._BindParamClause) \
+ and binary.right._identifying_key in nulls:
binary.right = expression.null()
binary.operator = operators.is_
binary.negate = operators.isnot