// the db name PMA_runProcedureAndFunctionDefinitions($GLOBALS['db']); // go back to current db, just in case $GLOBALS['dbi']->selectDb($GLOBALS['db']); $tables_full = $GLOBALS['dbi']->getTablesFull($GLOBALS['db']); include_once "libraries/plugin_interface.lib.php"; // remove all foreign key constraints, otherwise we can get errors /* @var $export_sql_plugin ExportSql */ $export_sql_plugin = PMA_getPlugin("export", "sql", 'libraries/plugins/export/', array('single_table' => isset($single_table), 'export_type' => 'database')); // create stand-in tables for views $views = PMA_getViewsAndCreateSqlViewStandIn($tables_full, $export_sql_plugin, $GLOBALS['db']); // 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)
// to avoid selecting alternatively the current and new db // we would need to modify the CREATE definitions to qualify // the db name PMA_runProcedureAndFunctionDefinitions($db); // go back to current db, just in case $GLOBALS['dbi']->selectDb($db); $tables_full = $GLOBALS['dbi']->getTablesFull($db); include_once "libraries/plugin_interface.lib.php"; // remove all foreign key constraints, otherwise we can get errors $export_sql_plugin = PMA_getPlugin("export", "sql", 'libraries/plugins/export/', array('single_table' => isset($single_table), 'export_type' => 'database')); $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);