Properly open and select database when "Use <db>" command is issued

This commit is contained in:
Kasun Chathuranga 2013-08-31 12:42:45 +05:30
parent 6f29a89aec
commit 9c8267a9a8
2 changed files with 15 additions and 7 deletions

View File

@ -78,7 +78,7 @@ var PMA_commonParams = (function () {
PMA_querywindow.refresh();
}
params[name] = value;
if(name == 'db' || name == 'table') {
if (name == 'db' || name == 'table') {
PMA_showCurrentNavigation();
}
return this;
@ -117,9 +117,7 @@ var PMA_commonActions = {
*/
setDb: function (new_db) {
if (new_db != PMA_commonParams.get('db')) {
PMA_commonParams.set('db', new_db);
PMA_showCurrentNavigation();
PMA_querywindow.refresh();
PMA_commonParams.setAll({'db': new_db, 'table': ''});
}
},
/**

View File

@ -296,7 +296,17 @@ AJAX.registerOnload('sql.js', function() {
} else if (typeof data.reload != 'undefined') {
// this happens if a USE or DROP command was typed
PMA_commonActions.setDb(data.db);
PMA_commonActions.refreshMain(false, function () {
var url;
if (data.db) {
if (data.table) {
url = 'table_sql.php';
} else {
url = 'db_sql.php';
}
} else {
url = 'server_sql.php';
}
PMA_commonActions.refreshMain(url, function () {
if ($('#result_query').length) {
$('#result_query').remove();
}
@ -307,7 +317,7 @@ AJAX.registerOnload('sql.js', function() {
}
});
}
$sqlqueryresults.show().trigger('makegrid');
$('#togglequerybox').show();
PMA_init_slider();
@ -581,7 +591,7 @@ function makeProfilingChart()
) {
return;
}
var data = [];
$.each(jQuery.parseJSON($('#profilingChartData').html()),function(key,value) {
data.push([key,parseFloat(value)]);