Added check for SELECT with LIMIT...this won't fly with SQLBase.
This commit is contained in:
parent
e44aecdf79
commit
5c8f88551a
1 changed files with 14 additions and 1 deletions
|
@ -29,6 +29,16 @@ from sqlalchemy.sql.compiler import SQLCompiler
|
|||
from sqlalchemy.sql.expression import Join
|
||||
|
||||
|
||||
class LimitClauseNotSupported(Exception):
|
||||
|
||||
def __init__(self, limit, offset):
|
||||
self.limit = limit
|
||||
self.offset = offset
|
||||
|
||||
def __str__(self):
|
||||
return "Centura SQLBase 7.5.1 doesn't support a LIMIT clause for the SELECT statement (received: limit = %u, offset = %u)" % (self.limit, self.offset)
|
||||
|
||||
|
||||
class SQLBase7Compiler(SQLCompiler):
|
||||
|
||||
# Most of the code below was copied from the Oracle dialect. Thanks to Michael Bayer
|
||||
|
@ -41,9 +51,12 @@ class SQLBase7Compiler(SQLCompiler):
|
|||
def visit_select(self, select, **kwargs):
|
||||
froms = select._get_display_froms()
|
||||
whereclause = self._get_join_whereclause(froms)
|
||||
if whereclause:
|
||||
if whereclause is not None:
|
||||
select = select.where(whereclause)
|
||||
|
||||
if select._limit is not None or select._offset is not None:
|
||||
raise LimitClauseNotSupported(select._limit, select._offset)
|
||||
|
||||
kwargs['iswrapper'] = getattr(select, '_is_wrapper', False)
|
||||
return SQLCompiler.visit_select(self, select, **kwargs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue