summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/mysql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-01-25 01:37:15 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-01-25 01:37:15 +0000
commit07ef7121aea88e8d2a9ce09c91f99c2b795b9351 (patch)
treea45ff5e84ffc5c7584f0cb4a489f19d195d48cef /lib/sqlalchemy/databases/mysql.py
parent9349ef38efad07157c163afa387820c870ce97e9 (diff)
downloadsqlalchemy-07ef7121aea88e8d2a9ce09c91f99c2b795b9351.tar.gz
- fix to reflection on older DB's that might return array() type for
"show variables like" statements
Diffstat (limited to 'lib/sqlalchemy/databases/mysql.py')
-rw-r--r--lib/sqlalchemy/databases/mysql.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index aee26a405..d30751fb4 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -10,6 +10,7 @@ from sqlalchemy import sql,engine,schema,ansisql
from sqlalchemy.engine import default
import sqlalchemy.types as sqltypes
import sqlalchemy.exceptions as exceptions
+from array import array
try:
import MySQLdb as mysql
@@ -338,7 +339,11 @@ class MySQLDialect(ansisql.ANSIDialect):
def reflecttable(self, connection, table):
# reference: http://dev.mysql.com/doc/refman/5.0/en/name-case-sensitivity.html
- case_sensitive = int(connection.execute("show variables like 'lower_case_table_names'").fetchone()[1]) == 0
+ cs = connection.execute("show variables like 'lower_case_table_names'").fetchone()[1]
+ if isinstance(cs, array):
+ cs = cs.tostring()
+ case_sensitive = int(cs) == 0
+
if not case_sensitive:
table.name = table.name.lower()
table.metadata.tables[table.name]= table