diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-08-29 16:35:02 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-08-29 16:35:02 -0400 |
commit | e4bc7d289477e22815f4c6ab86b3f0c1bf356e08 (patch) | |
tree | fdfe33b2ab7e5ef54b62877d4c17a56a401e23ed /lib/sqlalchemy/sql/compiler.py | |
parent | 87fd1e3260d957ae25c44cc2ac30ce97feb89b35 (diff) | |
download | sqlalchemy-e4bc7d289477e22815f4c6ab86b3f0c1bf356e08.tar.gz |
- move LIMIT/OFFSET rendering to be as bind parameters, for all backends
which support it. This includes SQLite, MySQL, Postgresql, Firebird,
Oracle (already used binds with ROW NUMBER OVER), MSSQL (when ROW NUMBER
is used, not TOP). Not included are Informix, Sybase, MaxDB, Access
[ticket:805]
- LIMIT/OFFSET parameters need to stay as literals within SQL
constructs. This because they may not be renderable as binds on
some backends.
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index fcff5e355..584e43a88 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -808,11 +808,11 @@ class SQLCompiler(engine.Compiled): def limit_clause(self, select): text = "" if select._limit is not None: - text += " \n LIMIT " + str(select._limit) + text += "\n LIMIT " + self.process(sql.literal(select._limit)) if select._offset is not None: if select._limit is None: - text += " \n LIMIT -1" - text += " OFFSET " + str(select._offset) + text += "\n LIMIT -1" + text += " OFFSET " + self.process(sql.literal(select._offset)) return text def visit_table(self, table, asfrom=False, ashint=False, fromhints=None, **kwargs): |