From 44abaa9e567e6c412a2ce499907c65d97aa865dc Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 7 Dec 2005 01:37:55 +0000 Subject: added rudimentary support for limit and offset (with the hack version in oracle) fixed up order_by to support a list/scalar of columns or asc/desc fixed up query.py unit test --- lib/sqlalchemy/databases/postgres.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/sqlalchemy/databases/postgres.py') diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 5a3d6388a..531e8af03 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -240,6 +240,16 @@ class PGCompiler(ansisql.ANSICompiler): if c.sequence is not None and not c.sequence.optional: self.bindparams[c.key] = None return ansisql.ANSICompiler.visit_insert(self, insert) + + def limit_clause(self, select): + text = "" + if select.limit is not None: + text += " \n LIMIT " + str(select.limit) + if select.offset is not None: + if select.limit is None: + text += " \n LIMIT ALL" + text += " OFFSET " + str(select.offset) + return text class PGSchemaGenerator(ansisql.ANSISchemaGenerator): def get_column_specification(self, column, override_pk=False, **kwargs): -- cgit v1.2.1