implementation of PMA_handleTheViews()
This commit is contained in:
parent
d3a599bc4e
commit
b2b394f583
@ -115,27 +115,9 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
|
||||
|
||||
// handle the views
|
||||
if (! $_error) {
|
||||
// temporarily force to add DROP IF EXIST to CREATE VIEW query,
|
||||
// to remove stand-in VIEW that was created earlier
|
||||
if (isset($GLOBALS['drop_if_exists'])) {
|
||||
$temp_drop_if_exists = $GLOBALS['drop_if_exists'];
|
||||
}
|
||||
$GLOBALS['drop_if_exists'] = 'true';
|
||||
|
||||
foreach ($views as $view) {
|
||||
if (! PMA_Table::moveCopy($db, $view, $newname, $view, 'structure', $move, 'db_copy')) {
|
||||
$_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($GLOBALS['drop_if_exists']);
|
||||
if (isset($temp_drop_if_exists)) {
|
||||
// restore previous value
|
||||
$GLOBALS['drop_if_exists'] = $temp_drop_if_exists;
|
||||
unset($temp_drop_if_exists);
|
||||
}
|
||||
$_error = PMA_handleTheViews($views, $move);
|
||||
}
|
||||
unset($view, $views);
|
||||
unset($views);
|
||||
|
||||
// now that all tables exist, create all the accumulated constraints
|
||||
if (! $_error && count($GLOBALS['sql_constraints_query_full_db']) > 0) {
|
||||
|
||||
@ -492,4 +492,38 @@ function PMA_runEventDefinitionsForDb()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the views, return the boolean value whether table rename/copy or not
|
||||
*
|
||||
* @param array $views views as an array
|
||||
* @param boolean $move whether databse name is empty or not
|
||||
*
|
||||
* @return boolean $_error whether table rename/copy or not
|
||||
*/
|
||||
function PMA_handleTheViews($views, $move)
|
||||
{
|
||||
$_error = false;
|
||||
// temporarily force to add DROP IF EXIST to CREATE VIEW query,
|
||||
// to remove stand-in VIEW that was created earlier
|
||||
if (isset($GLOBALS['drop_if_exists'])) {
|
||||
$temp_drop_if_exists = $GLOBALS['drop_if_exists'];
|
||||
}
|
||||
$GLOBALS['drop_if_exists'] = 'true';
|
||||
|
||||
foreach ($views as $view) {
|
||||
if (! PMA_Table::moveCopy($GLOBALS['db'], $view, $_REQUEST['newname'],
|
||||
$view, 'structure', $move, 'db_copy')
|
||||
) {
|
||||
$_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($GLOBALS['drop_if_exists']);
|
||||
if (isset($temp_drop_if_exists)) {
|
||||
// restore previous value
|
||||
$GLOBALS['drop_if_exists'] = $temp_drop_if_exists;
|
||||
}
|
||||
return $_error;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user