Fix expression evaluation with postgres
This commit is contained in:
@@ -76,7 +76,8 @@ class BaseAdapter(ConnectionPool):
|
|||||||
dbpath = None
|
dbpath = None
|
||||||
folder = None
|
folder = None
|
||||||
connector = lambda *args, **kwargs: None # __init__ should override this
|
connector = lambda *args, **kwargs: None # __init__ should override this
|
||||||
|
TRUE_exp = '1'
|
||||||
|
FALSE_exp = '0'
|
||||||
TRUE = 'T'
|
TRUE = 'T'
|
||||||
FALSE = 'F'
|
FALSE = 'F'
|
||||||
T_SEP = ' '
|
T_SEP = ' '
|
||||||
@@ -909,7 +910,7 @@ class BaseAdapter(ConnectionPool):
|
|||||||
return ','.join(self.represent(item,field_type) \
|
return ','.join(self.represent(item,field_type) \
|
||||||
for item in expression)
|
for item in expression)
|
||||||
elif isinstance(expression, bool):
|
elif isinstance(expression, bool):
|
||||||
return '1' if expression else '0'
|
return self.db._adapter.TRUE_exp if expression else self.db._adapter.FALSE_exp
|
||||||
else:
|
else:
|
||||||
return str(expression)
|
return str(expression)
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ class PostgreSQLAdapter(BaseAdapter):
|
|||||||
self.srid = srid
|
self.srid = srid
|
||||||
self.find_or_make_work_folder()
|
self.find_or_make_work_folder()
|
||||||
self._last_insert = None # for INSERT ... RETURNING ID
|
self._last_insert = None # for INSERT ... RETURNING ID
|
||||||
|
self.TRUE_exp = 'TRUE'
|
||||||
|
self.FALSE_exp = 'FALSE'
|
||||||
ruri = uri.split('://',1)[1]
|
ruri = uri.split('://',1)[1]
|
||||||
m = self.REGEX_URI.match(ruri)
|
m = self.REGEX_URI.match(ruri)
|
||||||
if not m:
|
if not m:
|
||||||
|
|||||||
Reference in New Issue
Block a user