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/sql/compiler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql/compiler.py') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 31193ab17..b59e8a941 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -29,6 +29,7 @@ from .. import util, exc import decimal import itertools import operator +from sqlalchemy.sql.elements import _literal_as_binds RESERVED_WORDS = set([ 'all', 'analyse', 'analyze', 'and', 'any', 'array', @@ -1625,11 +1626,11 @@ class SQLCompiler(Compiled): def limit_clause(self, select): text = "" if select._limit is not None: - text += "\n LIMIT " + self.process(elements.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 -1" - text += " OFFSET " + self.process(elements.literal(select._offset)) + text += " OFFSET " + self.process(_literal_as_binds(select._offset)) return text def visit_table(self, table, asfrom=False, iscrud=False, ashint=False, -- cgit v1.2.1