From e4bc7d289477e22815f4c6ab86b3f0c1bf356e08 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 29 Aug 2010 16:35:02 -0400 Subject: - 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. --- lib/sqlalchemy/dialects/sqlite/base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/sqlalchemy/dialects/sqlite') diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index b84b18e68..7bd6d51f3 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -222,13 +222,13 @@ class SQLiteCompiler(compiler.SQLCompiler): 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 " + self.process(sql.literal(-1)) + text += " OFFSET " + self.process(sql.literal(select._offset)) else: - text += " OFFSET 0" + text += " OFFSET " + self.process(sql.literal(0)) return text def for_update_clause(self, select): -- cgit v1.2.1