Bug fix #3818 After "Rename table ... to ..." left menu doesn't reflect changes

The left navigationa and the other places where the old table name was
showing up, now updates if the table is renamed.
This commit is contained in:
ayushchd 2013-02-25 14:28:27 +05:30
parent 2b9e628758
commit 69b73a44b0
3 changed files with 21 additions and 0 deletions

View File

@ -66,6 +66,12 @@ if (! empty($sql_query)) {
$GLOBALS['reload'] = true;
}
//do a dynamic reload if table is RENAMED (by sending the instruction to the AJAX response handler)
if (preg_match('/^RENAME\s+TABLE\s+(.*?)\s+TO\s+(.*?)($|;|\s)/i', $sql_query, $rename_table_names)) {
$ajax_reload_nav['table_name'] = $rename_table_names[2];
$ajax_reload_nav['reload'] = true;
}
$sql_query = '';
} elseif (! empty($sql_localfile)) {
// run SQL file on server

View File

@ -280,6 +280,14 @@ AJAX.registerOnload('sql.js', function() {
.show()
.html(data.message);
}
if (typeof data.ajax_reload_nav != 'undefined') {
if (data.ajax_reload_nav.reload) {
PMA_commonParams.set('table', data.ajax_reload_nav.table_name);
PMA_commonActions.refreshMain();
}
}
$sqlqueryresults.show().trigger('makegrid');
$('#togglequerybox').show();
PMA_init_slider();

View File

@ -27,6 +27,13 @@ $scripts->addFile('tbl_structure.js');
$scripts->addFile('indexes.js');
$scripts->addFile('gis_data_editor.js');
/**
* Set ajax_reload_nav in the response if it was already set
*/
if (isset($ajax_reload_nav) && $ajax_reload_nav['reload'] === true) {
$response->addJSON('ajax_reload_nav', $ajax_reload_nav);
}
/**
* Sets globals from $_POST
*/