From 087f235c33c1be4e0778231e8344a50dc4005c59 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 14 Aug 2007 21:53:32 +0000 Subject: - 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%. --- lib/sqlalchemy/ansisql.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'lib/sqlalchemy/ansisql.py') 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. -- cgit v1.2.1