From 338ca8e48827840ad5db4ee4f677e4d3fcd315c9 Mon Sep 17 00:00:00 2001 From: Dobes Vandermeer Date: Thu, 24 Apr 2014 15:20:57 -0700 Subject: Proof-of-concept implementation of supporting bindparam for offset and limit on a query. --- lib/sqlalchemy/dialects/postgresql/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/dialects/postgresql/base.py') diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index f69a6e010..d63e3ed87 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -346,6 +346,7 @@ from ... import sql, schema, exc, util from ...engine import default, reflection from ...sql import compiler, expression, operators from ... import types as sqltypes +from sqlalchemy.sql.elements import _literal_as_binds try: from uuid import UUID as _python_UUID @@ -1144,11 +1145,11 @@ class PGCompiler(compiler.SQLCompiler): def limit_clause(self, select): text = "" if select._limit is not None: - text += " \n LIMIT " + self.process(sql.literal(select._limit)) + text += " \n LIMIT " + self.process(_literal_as_binds(select._limit)) if select._offset is not None: if select._limit is None: text += " \n LIMIT ALL" - text += " OFFSET " + self.process(sql.literal(select._offset)) + text += " OFFSET " + self.process(_literal_as_binds(select._offset)) return text def format_from_hint_text(self, sqltext, table, hint, iscrud): -- cgit v1.2.1