summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ansisql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-08-14 21:53:32 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-08-14 21:53:32 +0000
commit087f235c33c1be4e0778231e8344a50dc4005c59 (patch)
treed47c35d1e520e43c05ec869304870c0b6c87f736 /lib/sqlalchemy/ansisql.py
parente58063aa91d893d76e9f34fbc3ea21818185844d (diff)
downloadsqlalchemy-087f235c33c1be4e0778231e8344a50dc4005c59.tar.gz
- merged "fasttypes" branch. this branch changes the signature
of convert_bind_param() and convert_result_value() to callable-returning bind_processor() and result_processor() methods. if no callable is returned, no pre/post processing function is called. - hooks added throughout base/sql/defaults to optimize the calling of bind param/result processors so that method call overhead is minimized. special cases added for executemany() scenarios such that unneeded "last row id" logic doesn't kick in, parameters aren't excessively traversed. - new performance tests show a combined mass-insert/mass-select test as having 68% fewer function calls than the same test run against 0.3. - general performance improvement of result set iteration is around 10-20%.
Diffstat (limited to 'lib/sqlalchemy/ansisql.py')
-rw-r--r--lib/sqlalchemy/ansisql.py20
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/sqlalchemy/ansisql.py b/lib/sqlalchemy/ansisql.py
index 4d50b6a25..dd4065f39 100644
--- a/lib/sqlalchemy/ansisql.py
+++ b/lib/sqlalchemy/ansisql.py
@@ -252,24 +252,14 @@ class ANSICompiler(engine.Compiled, sql.ClauseVisitor):
for a single statement execution, or one element of an executemany execution.
"""
- if self.parameters is not None:
- bindparams = self.parameters.copy()
- else:
- bindparams = {}
- bindparams.update(params)
d = sql.ClauseParameters(self.dialect, self.positiontup)
- for b in self.binds.values():
- name = self.bind_names[b]
- d.set_parameter(b, b.value, name)
- for key, value in bindparams.iteritems():
- try:
- b = self.binds[key]
- except KeyError:
- continue
- name = self.bind_names[b]
- d.set_parameter(b, value, name)
+ pd = self.parameters or {}
+ pd.update(params)
+ for key, bind in self.binds.iteritems():
+ d.set_parameter(bind, pd.get(key, bind.value), self.bind_names[bind])
+
return d
params = property(lambda self:self.construct_params({}), doc="""Return the `ClauseParameters` corresponding to this compiled object.