Added "long" type bind parameter check.

This commit is contained in:
Lance Edgar 2010-05-04 15:31:15 -05:00
parent 1a36f614cf
commit 6423627665

View file

@ -166,12 +166,17 @@ class SQLBase7Dialect(DefaultDialect):
return [] return []
def do_execute(self, cursor, statement, parameters, context=None): def do_execute(self, cursor, statement, parameters, context=None):
# Since the "supports_unicode_binds" attribute doesn't seem to do # For some (perhaps good?) reason, the SQLBase ODBC driver doesn't like
# anything, take matters into our own hands here. # parameters if they're of Unicode or Long type. I'd hoped at first that
# the "supports_unicode_binds" attribute would take care of the Unicode
# problem but it didn't seem to. And now that the Long parameters seem
# to throw the same error, so...
_parameters = [] _parameters = []
for parameter in parameters: for parameter in parameters:
if isinstance(parameter, basestring) and not isinstance(parameter, str): if isinstance(parameter, unicode):
parameter = str(parameter) parameter = str(parameter)
elif isinstance(parameter, long):
parameter = int(parameter)
_parameters.append(parameter) _parameters.append(parameter)
parameters = tuple(_parameters) parameters = tuple(_parameters)
cursor.execute(statement, parameters) cursor.execute(statement, parameters)