// copy tables $sqlConstratints = PMA_copyTables($tables_full, $move, $GLOBALS['db']); // handle the views if (!$_error) { PMA_handleTheViews($views, $move, $GLOBALS['db']); } unset($views); // now that all tables exist, create all the accumulated constraints if (!$_error && count($sqlConstratints) > 0) { PMA_createAllAccumulatedConstraints($sqlConstratints); } unset($sqlConstratints); if (PMA_MYSQL_INT_VERSION >= 50100) { // here DELIMITER is not used because it's not part of the // language; each statement is sent one by one PMA_runEventDefinitionsForDb($GLOBALS['db']); } // go back to current db, just in case $GLOBALS['dbi']->selectDb($GLOBALS['db']); // Duplicate the bookmarks for this db (done once for each db) PMA_duplicateBookmarks($_error, $GLOBALS['db']); if (!$_error && $move) { if (isset($_REQUEST['adjust_privileges']) && !empty($_REQUEST['adjust_privileges'])) { PMA_AdjustPrivileges_moveDB($GLOBALS['db'], $_REQUEST['newname']); } /** * cleanup pmadb stuff for this db */ include_once 'libraries/relation_cleanup.lib.php'; PMA_relationsCleanupDatabase($GLOBALS['db']); // if someday the RENAME DATABASE reappears, do not DROP
$GLOBALS['sql_constraints_query_full_db'] = PMA_getSqlConstraintsQueryForFullDb($tables_full, $export_sql_plugin, $move, $db); $views = PMA_getViewsAndCreateSqlViewStandIn($tables_full, $export_sql_plugin, $db); list($sql_query, $_error) = PMA_getSqlQueryForCopyTable($tables_full, $sql_query, $move, $db); // handle the views if (!$_error) { $_error = PMA_handleTheViews($views, $move, $db); } unset($views); // now that all tables exist, create all the accumulated constraints if (!$_error && count($GLOBALS['sql_constraints_query_full_db']) > 0) { PMA_createAllAccumulatedConstraints(); } if (!PMA_DRIZZLE && PMA_MYSQL_INT_VERSION >= 50100) { // here DELIMITER is not used because it's not part of the // language; each statement is sent one by one PMA_runEventDefinitionsForDb($db); } // go back to current db, just in case $GLOBALS['dbi']->selectDb($db); // Duplicate the bookmarks for this db (done once for each db) PMA_duplicateBookmarks($_error, $db); if (!$_error && $move) { /** * cleanup pmadb stuff for this db */ include_once 'libraries/relation_cleanup.lib.php'; PMA_relationsCleanupDatabase($db); // if someday the RENAME DATABASE reappears, do not DROP $local_query = 'DROP DATABASE ' . PMA_Util::backquote($db) . ';'; $sql_query .= "\n" . $local_query; $GLOBALS['dbi']->query($local_query);