From 0f8896e6fa692c0a91eb0980700bee069eddc8ef Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 30 Mar 2008 23:30:31 +0000 Subject: - reverted previous "strings instead of tuples" change due to more specific test results showing tuples faster - changed cache decorator call on default_schema_name call to a connection.info specific one --- lib/sqlalchemy/databases/mysql.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'lib/sqlalchemy/databases/mysql.py') diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index f09f08507..18b236d1c 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -157,6 +157,7 @@ import datetime, inspect, re, sys from array import array as _array from sqlalchemy import exceptions, logging, schema, sql, util +from sqlalchemy.pool import connection_cache_decorator from sqlalchemy.sql import operators as sql_operators from sqlalchemy.sql import functions as sql_functions from sqlalchemy.sql import compiler @@ -1542,13 +1543,9 @@ class MySQLDialect(default.DefaultDialect): return False def get_default_schema_name(self, connection): - try: - return connection.info['default_schema'] - except KeyError: - connection.info['default_schema'] = schema = \ - connection.execute('SELECT DATABASE()').scalar() - return schema - + return connection.execute('SELECT DATABASE()').scalar() + get_default_schema_name = connection_cache_decorator(get_default_schema_name) + def table_names(self, connection, schema): """Return a Unicode SHOW TABLES from a given schema.""" -- cgit v1.2.1