Permalink
Browse files

Bug #4135 When searching, error "No database selected"

  • Loading branch information...
1 parent e10c230 commit effa00f2097143fdb07fcd026f592c51d7879a50 @lem9 lem9 committed Oct 15, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −1 libraries/sql.lib.php
  2. +0 −1 sql.php
View
@@ -1319,7 +1319,8 @@ function PMA_hasCurrentDbChanged($db)
$reload = 0;
if (strlen($db)) {
$current_db = $GLOBALS['dbi']->fetchValue('SELECT DATABASE()');
- if ($db !== $current_db) {
+ // $current_db is false, except when a USE statement was sent
+ if ($current_db != false && $db !== $current_db) {
$reload = 1;
}
}
@@ -2286,6 +2287,7 @@ function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results,
}
$GLOBALS['reload'] = PMA_hasCurrentDbChanged($db);
+ $GLOBALS['dbi']->selectDb($db);
// Execute the query
list($result, $num_rows, $unlim_num_rows, $profiling_results,
View
@@ -173,7 +173,6 @@
);
} // end if
-$GLOBALS['dbi']->selectDb($db);
PMA_executeQueryAndSendQueryResponse(
$analyzed_sql_results,
$is_gotofile,

0 comments on commit effa00f

Please sign in to comment.