summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-11-07 21:48:16 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-11-07 21:48:16 +0000
commit4b6881af557baf36ba04766fd92bbca88dc515b5 (patch)
tree2f0009968debbf8fb8ccef34e5f91161f03bc595
parentf9c8d1cf34f93b895a9f3e6fd91d1718e0186951 (diff)
downloadsqlalchemy-4b6881af557baf36ba04766fd92bbca88dc515b5.tar.gz
- fix to compiled bind parameters to not mistakenly populate None
[ticket:853]
-rw-r--r--CHANGES3
-rw-r--r--lib/sqlalchemy/sql/compiler.py10
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 51f659f61..23a8f8981 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 9c8a6f56e..ba4842278 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])