Fixed boolean conditions in rendered SQL.

This commit is contained in:
Lance Edgar 2013-08-13 08:50:39 -07:00
parent b48e6cbb8d
commit 4650601041

View file

@ -36,19 +36,24 @@ class PervasiveCompiler(SQLCompiler):
Custom SQL statement compiler for Pervasive PSQL. Custom SQL statement compiler for Pervasive PSQL.
""" """
# This logic was basically copied from the ``sqlalchemy-access`` dialect.
def get_select_precolumns(self, select): def get_select_precolumns(self, select):
# This logic was copied from the ``sqlalchemy-access`` dialect.
s = 'DISTINCT ' if select._distinct else '' s = 'DISTINCT ' if select._distinct else ''
if select._limit: if select._limit:
s += 'TOP {0} '.format(select._limit) s += 'TOP {0} '.format(select._limit)
if select._offset: if select._offset:
raise InvalidRequestError( raise InvalidRequestError(
"Pervasive PSQL does not support TOP (limit) with an offset") "Pervasive PSQL does not support limit with an offset")
return s return s
def limit_clause(self, select): def limit_clause(self, select):
return "" return ''
def visit_true(self, expr, **kw):
return '1'
def visit_false(self, expr, **kw):
return '0'
class PervasiveDialect(DefaultDialect): class PervasiveDialect(DefaultDialect):