diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-01-02 21:24:17 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-01-02 21:24:17 +0000 |
commit | 5bc1f17cb53248e7cea609693a3b2a9bb702545b (patch) | |
tree | e31a0341ecacd3115612fcebfc904f1549535465 /lib/sqlalchemy/sql/compiler.py | |
parent | 2f2d84fbb14f1282677de8fc1186da8f41081214 (diff) | |
download | sqlalchemy-5bc1f17cb53248e7cea609693a3b2a9bb702545b.tar.gz |
- mysql, postgres: "%" signs in text() constructs are automatically escaped to "%%".
Because of the backwards incompatible nature of this change,
a warning is emitted if '%%' is detected in the string. [ticket:1267]
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 0430f053b..b286398bf 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -294,6 +294,9 @@ class DefaultCompiler(engine.Compiled): def visit_typeclause(self, typeclause, **kwargs): return typeclause.type.dialect_impl(self.dialect).get_col_spec() + def post_process_text(self, text): + return text + def visit_textclause(self, textclause, **kwargs): if textclause.typemap is not None: for colname, type_ in textclause.typemap.iteritems(): @@ -308,7 +311,7 @@ class DefaultCompiler(engine.Compiled): # un-escape any \:params return BIND_PARAMS_ESC.sub(lambda m: m.group(1), - BIND_PARAMS.sub(do_bindparam, textclause.text) + BIND_PARAMS.sub(do_bindparam, self.post_process_text(textclause.text)) ) def visit_null(self, null, **kwargs): |