summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/default.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-01-13 21:20:54 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-01-13 21:20:54 -0500
commit52b25c5319b982486348069e2d9edd5259be03d3 (patch)
tree71c7246d13f786131ed3083d39bd9143a91699fb /lib/sqlalchemy/engine/default.py
parentbd74f81bb5b1158a1bc0a44e9990d4584380c481 (diff)
downloadsqlalchemy-52b25c5319b982486348069e2d9edd5259be03d3.tar.gz
- _cursor_execute() will close the cursor on error; oracle doesn't allow double close
- ensure no iterator changed size issues in testing.engines
Diffstat (limited to 'lib/sqlalchemy/engine/default.py')
-rw-r--r--lib/sqlalchemy/engine/default.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py
index bcb9960b1..c1c012d33 100644
--- a/lib/sqlalchemy/engine/default.py
+++ b/lib/sqlalchemy/engine/default.py
@@ -240,20 +240,20 @@ class DefaultDialect(interfaces.Dialect):
parameters = {}
def check_unicode(test):
- cursor = connection.connection.cursor()
+ statement = cast_to(expression.select([test]).compile(dialect=self))
try:
- try:
- statement = cast_to(expression.select([test]).compile(dialect=self))
- connection._cursor_execute(cursor, statement, parameters)
- row = cursor.fetchone()
-
- return isinstance(row[0], util.text_type)
- except exc.DBAPIError as de:
- util.warn("Exception attempting to "
- "detect unicode returns: %r" % de)
- return False
- finally:
+ cursor = connection.connection.cursor()
+ connection._cursor_execute(cursor, statement, parameters)
+ row = cursor.fetchone()
cursor.close()
+ except exc.DBAPIError as de:
+ # note that _cursor_execute() will have closed the cursor
+ # if an exception is thrown.
+ util.warn("Exception attempting to "
+ "detect unicode returns: %r" % de)
+ return False
+ else:
+ return isinstance(row[0], util.text_type)
tests = [
# detect plain VARCHAR