For navigation fetch database names from INFORMATION_SCHEMA only

This commit is contained in:
Rouslan Placella 2012-07-04 17:37:35 +01:00
parent 228ca64fac
commit 9ba7490003
3 changed files with 9 additions and 20 deletions

View File

@ -51,6 +51,8 @@ class PMA_Navigation {
*/
public function __construct()
{
$GLOBALS['token'] = $_REQUEST['token'];
if (isset($_REQUEST['pos'])) {
$this->pos = (int) $_REQUEST['pos'];
}
@ -67,8 +69,8 @@ class PMA_Navigation {
private function _getNavigationDbPos() {
$query = "SELECT (COUNT(`SCHEMA_NAME`) DIV %d) * %d ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= "WHERE `SCHEMA_NAME` <= '%s'";
$query .= "WHERE `SCHEMA_NAME` < '%s' ";
$query .= "ORDER BY `SCHEMA_NAME` ASC";
return PMA_DBI_fetch_value(
sprintf(
$query,

View File

@ -320,22 +320,11 @@ class Node {
*/
public function getData($pos)
{
$retval = array();
if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
$query = "SELECT `SCHEMA_NAME` ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxDbList']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$query = "SHOW DATABASES";
$temp = PMA_DBI_fetch_result($query);
$num = min($GLOBALS['cfg']['MaxDbList'], count($temp)) + $pos;
$num = $num > count($temp) ? count($temp) : $num;
for ($i=$pos; $i<$num; $i++) {
$retval[] = $temp[$i];
}
}
return $retval;
$query = "SELECT `SCHEMA_NAME` ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= "ORDER BY `SCHEMA_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxDbList']}";
return PMA_DBI_fetch_result($query);
}
/**

View File

@ -12,8 +12,6 @@ require_once './libraries/common.inc.php';
// Also initialises the collapsible tree class
require_once './libraries/navigation/Navigation.class.php';
$GLOBALS['token'] = $_REQUEST['token'];
// Do the magic
$response = PMA_Response::getInstance();
if ($response->isAjax()) {