From: Mike Bayer Date: Sun, 19 Dec 2010 21:01:40 +0000 (-0500) Subject: - duh, compiled is per dialect X-Git-Tag: rel_0_7b1~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3687d7ab56841700fb087c8f0ddf0e3912e05cfd;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - duh, compiled is per dialect --- diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index ae0625d30f..38ff76b893 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -403,7 +403,7 @@ class DefaultExecutionContext(base.ExecutionContext): self.postfetch_cols = self.compiled.postfetch self.prefetch_cols = self.compiled.prefetch - processors = compiled._get_bind_processors(dialect) + processors = compiled._bind_processors # Convert the dictionary of bind parameter values # into a dict or list to be sent to the DBAPI's diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 0c76f3e74f..4c1fefa553 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -251,24 +251,16 @@ class SQLCompiler(engine.Compiled): # or dialect.max_identifier_length self.truncated_names = {} - # other memoized things - self._memos ={} - def _get_bind_processors(self, dialect): - key = 'bind_processors', dialect.__class__, \ - dialect.server_version_info - - if key not in self._memos: - self._memos[key] = processors = dict( + @util.memoized_property + def _bind_processors(self): + return dict( (key, value) for key, value in ( (self.bind_names[bindparam], - bindparam.type._cached_bind_processor(dialect)) + bindparam.type._cached_bind_processor(self.dialect)) for bindparam in self.bind_names ) if value is not None ) - return processors - else: - return self._memos[key] def is_subquery(self): return len(self.stack) > 1