change PMA_removeAllForeignKeyConstraints() function signature and improve
This commit is contained in:
parent
6a5f489539
commit
769f5a9bf9
@ -87,8 +87,6 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
|
||||
// go back to current db, just in case
|
||||
PMA_DBI_select_db($db);
|
||||
|
||||
$GLOBALS['sql_constraints_query_full_db'] = array();
|
||||
|
||||
$tables_full = PMA_DBI_get_tables_full($db);
|
||||
|
||||
require_once "libraries/plugin_interface.lib.php";
|
||||
@ -102,7 +100,10 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
|
||||
'single_table' => isset($single_table)
|
||||
)
|
||||
);
|
||||
PMA_removeAllForeignKeyConstraints($tables_full, $export_sql_plugin, $move);
|
||||
$GLOBALS['sql_constraints_query_full_db'] =
|
||||
PMA_getSqlConstraintsQueryForFullDb(
|
||||
$tables_full, $export_sql_plugin, $move
|
||||
);
|
||||
|
||||
$views = PMA_getViewsAndCreateSqlViewStandIn($tables_full, $export_sql_plugin);
|
||||
|
||||
|
||||
@ -338,14 +338,15 @@ function PMA_getSqlQueryAndCreateDbBeforeCopy()
|
||||
}
|
||||
|
||||
/**
|
||||
* remove all foreign key constraints
|
||||
* remove all foreign key constraints and return sql constraints query for full database
|
||||
*
|
||||
* @param array $tables_full array of all tables in given db or dbs
|
||||
* @param instance $export_sql_plugin export plugin instance
|
||||
* @param boolean $move whether databse name is empty or not
|
||||
*/
|
||||
function PMA_removeAllForeignKeyConstraints($tables_full, $export_sql_plugin, $move)
|
||||
function PMA_getSqlConstraintsQueryForFullDb($tables_full, $export_sql_plugin, $move)
|
||||
{
|
||||
$sql_constraints_query_full_db = array();
|
||||
foreach ($tables_full as $each_table => $tmp) {
|
||||
$sql_constraints = '';
|
||||
$sql_drop_foreign_keys = '';
|
||||
@ -357,9 +358,10 @@ function PMA_removeAllForeignKeyConstraints($tables_full, $export_sql_plugin, $m
|
||||
}
|
||||
// keep the constraint we just dropped
|
||||
if (! empty($sql_constraints)) {
|
||||
$GLOBALS['sql_constraints_query_full_db'][] = $sql_constraints;
|
||||
$sql_constraints_query_full_db[] = $sql_constraints;
|
||||
}
|
||||
}
|
||||
return $sql_constraints_query_full_db;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user