"""execute a string statement, using the raw cursor,
and return a scalar result."""
conn = self.context._connection
- if not self.dialect.supports_unicode_statements:
+ if isinstance(stmt, unicode) and not self.dialect.supports_unicode_statements:
stmt = stmt.encode(self.dialect.encoding)
conn._cursor_execute(self.context.cursor, stmt, params)
return self.context.cursor.fetchone()[0]
self.result_map = None
self.parameters = self.__encode_param_keys(parameters)
self.executemany = len(parameters) > 1
- if not dialect.supports_unicode_statements:
+ if isinstance(statement, unicode) and not dialect.supports_unicode_statements:
self.statement = statement.encode(self.dialect.encoding)
else:
self.statement = statement