From 5b8738b7e390471bd31b9ece90d0a3fd7653d859 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 6 Jul 2011 12:35:45 -0400 Subject: - 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. --- lib/sqlalchemy/sql/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql/util.py') 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 -- cgit v1.2.1