bug #2832600 [export] Slow export when having lots of databases

This commit is contained in:
Marc Delisle
2009-09-20 12:21:30 +00:00
parent 4c91f6e129
commit f990678a30
2 changed files with 13 additions and 1 deletions

View File

@@ -1322,14 +1322,25 @@ function PMA_DBI_get_triggers($db, $table)
{
$result = array();
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
// Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html
// their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this
// instead of WHERE EVENT_OBJECT_SCHEMA='dbname'
$triggers = PMA_DBI_fetch_result("SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddslashes($db,true) . "' and EVENT_OBJECT_TABLE = '" . PMA_sqlAddslashes($table, true) . "';");
$triggers = PMA_DBI_fetch_result("SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddslashes($db,true) . "' and EVENT_OBJECT_TABLE = '" . PMA_sqlAddslashes($table, true) . "';");
} else {
$triggers = PMA_DBI_fetch_result("SHOW TRIGGERS FROM " . PMA_sqlAddslashes($db,true) . " LIKE '" . PMA_sqlAddslashes($table, true) . "';");
}
if ($triggers) {
$delimiter = '//';
foreach ($triggers as $trigger) {
if ($GLOBALS['cfg']['Server']['DisableIS']) {
$trigger['TRIGGER_NAME'] = $trigger['Trigger'];
$trigger['ACTION_TIMING'] = $trigger['Timing'];
$trigger['EVENT_MANIPULATION'] = $trigger['Event'];
$trigger['EVENT_OBJECT_TABLE'] = $trigger['Table'];
$trigger['ACTION_STATEMENT'] = $trigger['Statement'];
}
$one_result = array();
$one_result['name'] = $trigger['TRIGGER_NAME'];
$one_result['action_timing'] = $trigger['ACTION_TIMING'];