summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-05-13 19:55:49 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-05-13 19:55:49 +0000
commit17684a1b81b63a436fcf4f8426bcd822bdb8d463 (patch)
treedf476f202c006b5b08ee62a27b2b1cff462c14bf /lib/sqlalchemy/sql/compiler.py
parent1b6306c69e730eafdae499443efeb83322ce03e8 (diff)
downloadsqlalchemy-17684a1b81b63a436fcf4f8426bcd822bdb8d463.tar.gz
- LIMIT/OFFSET of zero is detected within compiler and is counted
- Query.__getitem__ now returns list/scalar in all cases, not generative (#1035) - added Query.slice_() which provides the simple "limit/offset from a positive range" operation, we can rename this to range_()/section()/_something_private_because_users_shouldnt_do_this() as needed
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 78bb4e31c..02164d8b6 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -351,7 +351,7 @@ class DefaultCompiler(engine.Compiled):
text += " GROUP BY " + group_by
text += self.order_by_clause(cs)
- text += (cs._limit or cs._offset) and self.limit_clause(cs) or ""
+ text += (cs._limit is not None or cs._offset is not None) and self.limit_clause(cs) or ""
self.stack.pop(-1)
@@ -537,7 +537,7 @@ class DefaultCompiler(engine.Compiled):
text += " \nHAVING " + t
text += self.order_by_clause(select)
- text += (select._limit or select._offset) and self.limit_clause(select) or ""
+ text += (select._limit is not None or select._offset is not None) and self.limit_clause(select) or ""
text += self.for_update_clause(select)
self.stack.pop(-1)