From 4c0e653de0aa48c277a2612f70d0c17442bf779c Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Pontier?= Date: Thu, 24 Jun 2010 10:01:21 -0400 Subject: [PATCH] patch #2932113 Slow export when having lots of databases --- ChangeLog | 2 ++ libraries/mysql_charsets.lib.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d259bac3cd..62009196e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ $Id$ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyAdmin/ChangeLog $ 3.3.5.0 (not yet released) +- patch #2932113 [information_schema] Slow export when having lots of + databases, thanks to Stéphane Pontier - shadow_walker 3.3.4.0 (not yet released) - bug #2996161 [import] properly escape import value diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php index b0274d2233..0b583d6a09 100644 --- a/libraries/mysql_charsets.lib.php +++ b/libraries/mysql_charsets.lib.php @@ -164,7 +164,17 @@ function PMA_getDbCollation($db) { return 'utf8_general_ci'; } - return PMA_DBI_fetch_value('SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = \'' . PMA_sqlAddSlashes($db) . '\' LIMIT 1;'); + if (! $GLOBALS['cfg']['Server']['DisableIS']) { + // this is slow with thousands of databases + return PMA_DBI_fetch_value('SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = \'' . PMA_sqlAddSlashes($db) . '\' LIMIT 1;'); + } else { + PMA_DBI_select_db($db); + $return = PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'collation_database\'', 0, 1); + if ($db !== $GLOBALS['db']) { + PMA_DBI_select_db($GLOBALS['db']); + } + return $return; + } } /** -- 2.11.4.GIT