From 4b6881af557baf36ba04766fd92bbca88dc515b5 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 7 Nov 2007 21:48:16 +0000 Subject: [PATCH] - fix to compiled bind parameters to not mistakenly populate None [ticket:853] --- CHANGES | 3 +++ lib/sqlalchemy/sql/compiler.py | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 51f659f61b..23a8f8981a 100644 --- a/CHANGES +++ b/CHANGES @@ -42,6 +42,9 @@ CHANGES - fixed the close() method on Transaction when using strategy='threadlocal' + - fix to compiled bind parameters to not mistakenly populate None + [ticket:853] + - orm - eager loading with LIMIT/OFFSET applied no longer adds the primary table joined to a limited subquery of itself; the eager loads now diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 9c8a6f56e3..ba48422785 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -189,9 +189,13 @@ class DefaultCompiler(engine.Compiled): if params: pd = {} - for key, bindparam in self.binds.iteritems(): - name = self.bind_names[bindparam] - pd[name] = params.get(key, bindparam.value) + for bindparam, name in self.bind_names.iteritems(): + for paramname in (bindparam.key, bindparam.shortname, name): + if paramname in params: + pd[name] = params[paramname] + break + else: + pd[name] = bindparam.value return pd else: return dict([(self.bind_names[bindparam], bindparam.value) for bindparam in self.bind_names]) -- 2.47.3