diff options
author | Piotr Przybylski <piotrprz@gmail.com> | 2011-06-25 03:00:00 +0400 |
---|---|---|
committer | Piotr Przybylski <piotrprz@gmail.com> | 2011-06-25 03:00:00 +0400 |
commit | 7d99d57ccafc9be02f34def4b44de33da6731de5 (patch) | |
tree | 04a0e21e6faaf940e29eacb5ee75f5a03d96fb86 /db_operations.php | |
parent | e38b5cd4ffc534a19f7f339f96b0e2197b02363c (diff) | |
parent | 5403fc13ced5e245632ba1b4f237ff5f1a52785f (diff) |
Merge remote-tracking branch 'origin/master' into drizzle
Diffstat (limited to 'db_operations.php')
-rw-r--r-- | db_operations.php | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/db_operations.php b/db_operations.php index 3bb4207dac..8ad23b763b 100644 --- a/db_operations.php +++ b/db_operations.php @@ -47,7 +47,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { // lower_case_table_names=1 `DB` becomes `db` $lower_case_table_names = PMA_DBI_fetch_value('SHOW VARIABLES LIKE "lower_case_table_names"', 0, 1); if ($lower_case_table_names === '1') { - $newname = strtolower($newname); + $newname = PMA_strtolower($newname); } $local_query = 'CREATE DATABASE ' . PMA_backquote($newname); @@ -69,37 +69,36 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { $GLOBALS['pma']->databases->build(); } - if (PMA_MYSQL_INT_VERSION >= 50000) { - // here I don't use DELIMITER because it's not part of the - // language; I have to send each statement one by one - - // to avoid selecting alternatively the current and new db - // we would need to modify the CREATE definitions to qualify - // the db name - $procedure_names = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE'); - if ($procedure_names) { - foreach($procedure_names as $procedure_name) { - PMA_DBI_select_db($db); - $tmp_query = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name); - // collect for later display - $GLOBALS['sql_query'] .= "\n" . $tmp_query; - PMA_DBI_select_db($newname); - PMA_DBI_query($tmp_query); - } + // here I don't use DELIMITER because it's not part of the + // language; I have to send each statement one by one + + // to avoid selecting alternatively the current and new db + // we would need to modify the CREATE definitions to qualify + // the db name + $procedure_names = PMA_DBI_get_procedures_or_functions($db, 'PROCEDURE'); + if ($procedure_names) { + foreach($procedure_names as $procedure_name) { + PMA_DBI_select_db($db); + $tmp_query = PMA_DBI_get_definition($db, 'PROCEDURE', $procedure_name); + // collect for later display + $GLOBALS['sql_query'] .= "\n" . $tmp_query; + PMA_DBI_select_db($newname); + PMA_DBI_query($tmp_query); } + } - $function_names = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION'); - if ($function_names) { - foreach($function_names as $function_name) { - PMA_DBI_select_db($db); - $tmp_query = PMA_DBI_get_definition($db, 'FUNCTION', $function_name); - // collect for later display - $GLOBALS['sql_query'] .= "\n" . $tmp_query; - PMA_DBI_select_db($newname); - PMA_DBI_query($tmp_query); - } + $function_names = PMA_DBI_get_procedures_or_functions($db, 'FUNCTION'); + if ($function_names) { + foreach($function_names as $function_name) { + PMA_DBI_select_db($db); + $tmp_query = PMA_DBI_get_definition($db, 'FUNCTION', $function_name); + // collect for later display + $GLOBALS['sql_query'] .= "\n" . $tmp_query; + PMA_DBI_select_db($newname); + PMA_DBI_query($tmp_query); } } + // go back to current db, just in case PMA_DBI_select_db($db); |