summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-11-01 03:58:21 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-11-01 03:58:21 +0000
commit66cd772094f22e78cd044c40aa3c72ced6493d2a (patch)
tree9887754057fea4d60ef5e78b0a77d90884ab22e4 /lib/sqlalchemy/sql/compiler.py
parentad9f8b8158ebd5509eb98c45179f1187f52c96d0 (diff)
downloadsqlalchemy-66cd772094f22e78cd044c40aa3c72ced6493d2a.tar.gz
- merged factor_down_bindparams branch.
- removed ClauseParameters object; compiled.params returns a regular dictionary now, as well as result.last_inserted_params()/last_updated_params(). - various code trimming, method removals.
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 43b6fb15b..fa4ac5a9f 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -182,27 +182,18 @@ class DefaultCompiler(engine.Compiled, visitors.ClauseVisitor):
return None
def construct_params(self, params=None):
- """Return a sql.util.ClauseParameters object.
+ """return a dictionary of bind parameter keys and values"""
- Combines the given bind parameter dictionary (string keys to object values)
- with the _BindParamClause objects stored within this Compiled object
- to produce a ClauseParameters structure, representing the bind arguments
- for a single statement execution, or one element of an executemany execution.
- """
-
- d = sql_util.ClauseParameters(self.dialect, self.positiontup)
-
- pd = params or {}
-
- bind_names = self.bind_names
- for key, bind in self.binds.iteritems():
- # the following is an inlined ClauseParameters.set_parameter()
- name = bind_names[bind]
- d._binds[name] = [bind, name, pd.get(key, bind.value)]
- return d
+ if params:
+ pd = {}
+ for key, bindparam in self.binds.iteritems():
+ name = self.bind_names[bindparam]
+ pd[name] = params.get(key, bindparam.value)
+ return pd
+ else:
+ return dict([(self.bind_names[bindparam], bindparam.value) for bindparam in self.bind_names])
- params = property(lambda self:self.construct_params(), doc="""Return the `ClauseParameters` corresponding to this compiled object.
- A shortcut for `construct_params()`.""")
+ params = property(lambda self:self.construct_params(), doc="""return a dictionary of bind parameter keys and values""")
def default_from(self):
"""Called when a SELECT statement has no froms, and no FROM clause is to be appended.