diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-04-07 13:34:38 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-04-07 13:34:38 -0400 |
| commit | 51fea2e159ca93daa0bc8066a5c35d8436d99418 (patch) | |
| tree | b66da19cf5cd027a31a7b574dbeee5ecd529527b /lib/sqlalchemy/sql | |
| parent | 708a25e76a3cb9528c65d45ad37fc562cf178e44 (diff) | |
| download | sqlalchemy-51fea2e159ca93daa0bc8066a5c35d8436d99418.tar.gz | |
- The limit/offset keywords to select() as well
as the value passed to select.limit()/offset()
will be coerced to integer. [ticket:2116]
(also in 0.6.7)
- Oracle dialect adds use_binds_for_limits=False
create_engine() flag, will render the LIMIT/OFFSET
values inline instead of as binds, reported to
modify the execution plan used by Oracle.
[ticket:2116] (Also in 0.6.7)
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/expression.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 3323dcca9..f5ec41a60 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -3972,6 +3972,8 @@ class _SelectBase(Executable, FromClause): _order_by_clause = ClauseList() _group_by_clause = ClauseList() + _limit = None + _offset = None def __init__(self, use_labels=False, @@ -3991,8 +3993,10 @@ class _SelectBase(Executable, FromClause): self._execution_options = \ self._execution_options.union({'autocommit' : autocommit}) - self._limit = limit - self._offset = offset + if limit is not None: + self._limit = util.asint(limit) + if offset is not None: + self._offset = util.asint(offset) self._bind = bind if order_by is not None: @@ -4061,14 +4065,14 @@ class _SelectBase(Executable, FromClause): """return a new selectable with the given LIMIT criterion applied.""" - self._limit = limit + self._limit = util.asint(limit) @_generative def offset(self, offset): """return a new selectable with the given OFFSET criterion applied.""" - self._offset = offset + self._offset = util.asint(offset) @_generative def order_by(self, *clauses): |
