commit
701a8855fd
@ -105,13 +105,9 @@ class Bookmark
|
||||
* @return boolean whether the INSERT succeeds or not
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource $controllink the controluser db connection handle
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
global $controllink;
|
||||
|
||||
$cfgBookmark = self::getParams();
|
||||
if (empty($cfgBookmark)) {
|
||||
return false;
|
||||
@ -124,7 +120,7 @@ class Bookmark
|
||||
. "'" . $GLOBALS['dbi']->escapeString($this->_user) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($this->_query) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($this->_label) . "')";
|
||||
return $GLOBALS['dbi']->query($query, $controllink);
|
||||
return $GLOBALS['dbi']->query($query, DatabaseInterface::CONNECT_CONTROL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,13 +129,9 @@ class Bookmark
|
||||
* @return bool true if successful
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource $controllink the controluser db connection handle
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
global $controllink;
|
||||
|
||||
$cfgBookmark = self::getParams();
|
||||
if (empty($cfgBookmark)) {
|
||||
return false;
|
||||
@ -148,7 +140,7 @@ class Bookmark
|
||||
$query = "DELETE FROM " . Util::backquote($cfgBookmark['db'])
|
||||
. "." . Util::backquote($cfgBookmark['table'])
|
||||
. " WHERE id = " . $this->_id;
|
||||
return $GLOBALS['dbi']->tryQuery($query, $controllink);
|
||||
return $GLOBALS['dbi']->tryQuery($query, DatabaseInterface::CONNECT_CONTROL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -259,13 +251,9 @@ class Bookmark
|
||||
* @return Bookmark[] the bookmarks list
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource $controllink the controluser db connection handle
|
||||
*/
|
||||
public static function getList($db = false)
|
||||
{
|
||||
global $controllink;
|
||||
|
||||
$cfgBookmark = self::getParams();
|
||||
if (empty($cfgBookmark)) {
|
||||
return array();
|
||||
@ -284,7 +272,7 @@ class Bookmark
|
||||
$query,
|
||||
null,
|
||||
null,
|
||||
$controllink,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -320,14 +308,10 @@ class Bookmark
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource $controllink the controluser db connection handle
|
||||
*
|
||||
*/
|
||||
public static function get($db, $id, $id_field = 'id',
|
||||
$action_bookmark_all = false, $exact_user_match = false
|
||||
) {
|
||||
global $controllink;
|
||||
|
||||
$cfgBookmark = self::getParams();
|
||||
if (empty($cfgBookmark)) {
|
||||
return null;
|
||||
@ -347,7 +331,7 @@ class Bookmark
|
||||
$query .= " AND " . Util::backquote($id_field)
|
||||
. " = " . $GLOBALS['dbi']->escapeString($id) . " LIMIT 1";
|
||||
|
||||
$result = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', $controllink);
|
||||
$result = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL);
|
||||
if (! empty($result)) {
|
||||
$bookmark = new Bookmark();
|
||||
$bookmark->_id = $result['id'];
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Charsets;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -68,7 +69,7 @@ class CentralColumns
|
||||
return array();
|
||||
}
|
||||
$pmadb = $cfgCentralColumns['db'];
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL);
|
||||
$central_list_table = $cfgCentralColumns['table'];
|
||||
//get current values of $db from central column list
|
||||
if ($num == 0) {
|
||||
@ -80,7 +81,7 @@ class CentralColumns
|
||||
. 'LIMIT ' . $from . ', ' . $num . ';';
|
||||
}
|
||||
$has_list = (array) $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
$query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
self::handleColumnExtra($has_list);
|
||||
return $has_list;
|
||||
@ -100,13 +101,13 @@ class CentralColumns
|
||||
return 0;
|
||||
}
|
||||
$pmadb = $cfgCentralColumns['db'];
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL);
|
||||
$central_list_table = $cfgCentralColumns['table'];
|
||||
$query = 'SELECT count(db_name) FROM ' .
|
||||
Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\';';
|
||||
$res = $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
$query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
if (isset($res[0])) {
|
||||
return $res[0];
|
||||
@ -131,13 +132,13 @@ class CentralColumns
|
||||
return array();
|
||||
}
|
||||
$pmadb = $cfgCentralColumns['db'];
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL);
|
||||
$central_list_table = $cfgCentralColumns['table'];
|
||||
if ($allFields) {
|
||||
$query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
$has_list = (array) $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
$query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
self::handleColumnExtra($has_list);
|
||||
} else {
|
||||
@ -145,7 +146,7 @@ class CentralColumns
|
||||
. Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
$has_list = (array) $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
$query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
}
|
||||
|
||||
@ -233,7 +234,7 @@ class CentralColumns
|
||||
$db = $_REQUEST['db'];
|
||||
$pmadb = $cfgCentralColumns['db'];
|
||||
$central_list_table = $cfgCentralColumns['table'];
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
$existingCols = array();
|
||||
$cols = "";
|
||||
$insQuery = array();
|
||||
@ -242,7 +243,7 @@ class CentralColumns
|
||||
if ($isTable) {
|
||||
foreach ($field_select as $table) {
|
||||
$fields[$table] = (array) $GLOBALS['dbi']->getColumns(
|
||||
$db, $table, null, true, $GLOBALS['userlink']
|
||||
$db, $table, null, true
|
||||
);
|
||||
foreach ($fields[$table] as $field => $def) {
|
||||
$cols .= "'" . $GLOBALS['dbi']->escapeString($field) . "',";
|
||||
@ -275,7 +276,7 @@ class CentralColumns
|
||||
$has_list[] = $column;
|
||||
$field = (array) $GLOBALS['dbi']->getColumns(
|
||||
$db, $table, $column,
|
||||
true, $GLOBALS['userlink']
|
||||
true
|
||||
);
|
||||
$insQuery[] = self::getInsertQuery(
|
||||
$column, $field, $db, $central_list_table
|
||||
@ -301,14 +302,14 @@ class CentralColumns
|
||||
)
|
||||
);
|
||||
}
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL);
|
||||
if (! empty($insQuery)) {
|
||||
foreach ($insQuery as $query) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, DatabaseInterface::CONNECT_CONTROL)) {
|
||||
$message = Message::error(__('Could not add columns!'));
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
|
||||
$GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
)
|
||||
);
|
||||
break;
|
||||
@ -338,7 +339,7 @@ class CentralColumns
|
||||
$db = $_REQUEST['db'];
|
||||
$pmadb = $cfgCentralColumns['db'];
|
||||
$central_list_table = $cfgCentralColumns['table'];
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
$message = true;
|
||||
$colNotExist = array();
|
||||
$fields = array();
|
||||
@ -346,7 +347,7 @@ class CentralColumns
|
||||
$cols = '';
|
||||
foreach ($field_select as $table) {
|
||||
$fields[$table] = (array) $GLOBALS['dbi']->getColumnNames(
|
||||
$db, $table, $GLOBALS['userlink']
|
||||
$db, $table
|
||||
);
|
||||
foreach ($fields[$table] as $col_select) {
|
||||
$cols .= '\'' . $GLOBALS['dbi']->escapeString($col_select) . '\',';
|
||||
@ -386,17 +387,17 @@ class CentralColumns
|
||||
)
|
||||
);
|
||||
}
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL);
|
||||
|
||||
$query = 'DELETE FROM ' . Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, DatabaseInterface::CONNECT_CONTROL)) {
|
||||
$message = Message::error(__('Could not remove columns!'));
|
||||
$message->addHtml('<br />' . htmlspecialchars($cols) . '<br />');
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
|
||||
$GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -418,7 +419,7 @@ class CentralColumns
|
||||
foreach ($selected_tables as $table) {
|
||||
$query = 'ALTER TABLE ' . Util::backquote($table);
|
||||
$has_list = self::getFromTable($db, $table, true);
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
foreach ($has_list as $column) {
|
||||
$column_status = Relation::checkChildForeignReferences(
|
||||
$db, $table, $column['col_name']
|
||||
@ -455,14 +456,14 @@ class CentralColumns
|
||||
}
|
||||
}
|
||||
$query = trim($query, " ,") . ";";
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['userlink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query)) {
|
||||
if ($message === true) {
|
||||
$message = Message::error(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['userlink'])
|
||||
$GLOBALS['dbi']->getError()
|
||||
);
|
||||
} else {
|
||||
$message->addText(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['userlink']),
|
||||
$GLOBALS['dbi']->getError(),
|
||||
'<br />'
|
||||
);
|
||||
}
|
||||
@ -488,9 +489,9 @@ class CentralColumns
|
||||
if (empty($cfgCentralColumns)) {
|
||||
return array();
|
||||
}
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
$fields = (array) $GLOBALS['dbi']->getColumnNames(
|
||||
$db, $table, $GLOBALS['userlink']
|
||||
$db, $table
|
||||
);
|
||||
$cols = '';
|
||||
foreach ($fields as $col_select) {
|
||||
@ -529,7 +530,7 @@ class CentralColumns
|
||||
return self::configErrorMessage();
|
||||
}
|
||||
$centralTable = $cfgCentralColumns['table'];
|
||||
$GLOBALS['dbi']->selectDb($cfgCentralColumns['db'], $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($cfgCentralColumns['db'], DatabaseInterface::CONNECT_CONTROL);
|
||||
if ($orig_col_name == "") {
|
||||
$def = array();
|
||||
$def['Type'] = $col_type;
|
||||
@ -556,9 +557,9 @@ class CentralColumns
|
||||
. 'AND col_name = \'' . $GLOBALS['dbi']->escapeString($orig_col_name)
|
||||
. '\'';
|
||||
}
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, DatabaseInterface::CONNECT_CONTROL)) {
|
||||
return Message::error(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
|
||||
$GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
);
|
||||
}
|
||||
return true;
|
||||
@ -753,8 +754,8 @@ class CentralColumns
|
||||
*/
|
||||
public static function getHtmlForTableDropdown($db)
|
||||
{
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$tables = $GLOBALS['dbi']->getTables($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
$tables = $GLOBALS['dbi']->getTables($db);
|
||||
$selectHtml = '<select name="table-select" id="table-select">'
|
||||
. '<option value="" disabled="disabled" selected="selected">'
|
||||
. __('Select a table') . '</option>';
|
||||
@ -778,9 +779,9 @@ class CentralColumns
|
||||
public static function getHtmlForColumnDropdown($db, $selected_tbl)
|
||||
{
|
||||
$existing_cols = self::getFromTable($db, $selected_tbl);
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
$columns = (array) $GLOBALS['dbi']->getColumnNames(
|
||||
$db, $selected_tbl, $GLOBALS['userlink']
|
||||
$db, $selected_tbl
|
||||
);
|
||||
$selectColHtml = "";
|
||||
foreach ($columns as $column) {
|
||||
@ -1157,9 +1158,9 @@ class CentralColumns
|
||||
$query = 'SELECT * FROM ' . Util::backquote($centralTable) . ' '
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\';';
|
||||
} else {
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
$columns = (array) $GLOBALS['dbi']->getColumnNames(
|
||||
$db, $table, $GLOBALS['userlink']
|
||||
$db, $table
|
||||
);
|
||||
$cols = '';
|
||||
foreach ($columns as $col_select) {
|
||||
@ -1173,9 +1174,9 @@ class CentralColumns
|
||||
}
|
||||
$query .= ';';
|
||||
}
|
||||
$GLOBALS['dbi']->selectDb($cfgCentralColumns['db'], $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($cfgCentralColumns['db'], DatabaseInterface::CONNECT_CONTROL);
|
||||
$columns_list = (array)$GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
$query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
self::handleColumnExtra($columns_list);
|
||||
return json_encode($columns_list);
|
||||
|
||||
@ -37,7 +37,7 @@ class ServerBinlogController extends Controller
|
||||
'SHOW MASTER LOGS',
|
||||
'Log_name',
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ namespace PhpMyAdmin\Controllers\Server;
|
||||
|
||||
use PhpMyAdmin\Controllers\Controller;
|
||||
use PhpMyAdmin\Charsets;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Server\Common;
|
||||
@ -114,7 +115,7 @@ class ServerDatabasesController extends Controller
|
||||
*/
|
||||
if ($GLOBALS['server'] > 0) {
|
||||
$this->_databases = $this->dbi->getDatabasesFull(
|
||||
null, $this->_dbstats, null, $this->_sort_by,
|
||||
null, $this->_dbstats, DatabaseInterface::CONNECT_USER, $this->_sort_by,
|
||||
$this->_sort_order, $this->_pos, true
|
||||
);
|
||||
$this->_database_count = count($GLOBALS['dblist']->databases);
|
||||
|
||||
@ -325,7 +325,7 @@ class TableRelationController extends TableController
|
||||
. Util::backquote($_REQUEST['foreignDb']);
|
||||
$tables_rs = $this->dbi->query(
|
||||
$query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -341,7 +341,7 @@ class TableRelationController extends TableController
|
||||
. Util::backquote($_REQUEST['foreignDb']);
|
||||
$tables_rs = $this->dbi->query(
|
||||
$query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
while ($row = $this->dbi->fetchArray($tables_rs)) {
|
||||
|
||||
@ -310,7 +310,9 @@ class TableSearchController extends TableController
|
||||
|
||||
//Query execution part
|
||||
$result = $this->dbi->query(
|
||||
$sql_query . ";", null, DatabaseInterface::QUERY_STORE
|
||||
$sql_query . ";",
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$fields_meta = $this->dbi->getFieldsMeta($result);
|
||||
$data = array();
|
||||
@ -411,7 +413,9 @@ class TableSearchController extends TableController
|
||||
$row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`'
|
||||
. $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause'];
|
||||
$result = $this->dbi->query(
|
||||
$row_info_query . ";", null, DatabaseInterface::QUERY_STORE
|
||||
$row_info_query . ";",
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$fields_meta = $this->dbi->getFieldsMeta($result);
|
||||
while ($row = $this->dbi->fetchAssoc($result)) {
|
||||
@ -730,7 +734,9 @@ class TableSearchController extends TableController
|
||||
// is case sensitive
|
||||
}
|
||||
$this->dbi->query(
|
||||
$sql_query, null, DatabaseInterface::QUERY_STORE
|
||||
$sql_query,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$GLOBALS['sql_query'] = $sql_query;
|
||||
}
|
||||
|
||||
@ -331,7 +331,8 @@ class Core
|
||||
{
|
||||
$tables = $GLOBALS['dbi']->tryQuery(
|
||||
'SHOW TABLES FROM ' . Util::backquote($db) . ';',
|
||||
null, DatabaseInterface::QUERY_STORE
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if ($tables) {
|
||||
$num_tables = $GLOBALS['dbi']->numRows($tables);
|
||||
|
||||
@ -14,9 +14,6 @@ use PhpMyAdmin\ListDatabase;
|
||||
* holds the DatabaseList class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*
|
||||
* @property object $userlink
|
||||
* @property object $controllink
|
||||
*/
|
||||
class DatabaseList
|
||||
{
|
||||
@ -27,20 +24,6 @@ class DatabaseList
|
||||
*/
|
||||
protected $databases = null;
|
||||
|
||||
/**
|
||||
* DBMS user link
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $userlink = null;
|
||||
|
||||
/**
|
||||
* DBMS control link
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $controllink = null;
|
||||
|
||||
/**
|
||||
* magic access to protected/inaccessible members/properties
|
||||
*
|
||||
@ -54,36 +37,11 @@ class DatabaseList
|
||||
switch ($param) {
|
||||
case 'databases' :
|
||||
return $this->getDatabaseList();
|
||||
case 'userlink' :
|
||||
return $this->userlink;
|
||||
case 'controllink' :
|
||||
return $this->controllink;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* magic access to protected/inaccessible members/properties
|
||||
*
|
||||
* @param string $param parameter name
|
||||
* @param mixed $value value to set
|
||||
*
|
||||
* @return void
|
||||
* @see https://secure.php.net/language.oop5.overloading
|
||||
*/
|
||||
public function __set($param, $value)
|
||||
{
|
||||
switch ($param) {
|
||||
case 'userlink' :
|
||||
$this->userlink = $value;
|
||||
break;
|
||||
case 'controllink' :
|
||||
$this->controllink = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor to PMA::$databases
|
||||
*
|
||||
@ -92,9 +50,7 @@ class DatabaseList
|
||||
public function getDatabaseList()
|
||||
{
|
||||
if (null === $this->databases) {
|
||||
$this->databases = new ListDatabase(
|
||||
$this->userlink
|
||||
);
|
||||
$this->databases = new ListDatabase();
|
||||
}
|
||||
|
||||
return $this->databases;
|
||||
|
||||
@ -323,7 +323,7 @@ class Qbe
|
||||
} // end if
|
||||
$all_tables = $GLOBALS['dbi']->query(
|
||||
'SHOW TABLES FROM ' . Util::backquote($this->_db) . ';',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$all_tables_count = $GLOBALS['dbi']->numRows($all_tables);
|
||||
|
||||
@ -67,6 +67,13 @@ class DatabaseInterface
|
||||
*/
|
||||
private $_extension;
|
||||
|
||||
/**
|
||||
* Opened database links
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_links;
|
||||
|
||||
/**
|
||||
* @var array Table data cache
|
||||
*/
|
||||
@ -116,6 +123,11 @@ class DatabaseInterface
|
||||
public function __construct($ext)
|
||||
{
|
||||
$this->_extension = $ext;
|
||||
$this->_links = array();
|
||||
if (defined('TESTSUITE')) {
|
||||
$this->_links[DatabaseInterface::CONNECT_USER] = 1;
|
||||
$this->_links[DatabaseInterface::CONNECT_CONTROL] = 2;
|
||||
}
|
||||
$this->_table_cache = array();
|
||||
$this->_current_user = array();
|
||||
$this->types = new Types($this);
|
||||
@ -146,7 +158,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function query($query, $link = null, $options = 0,
|
||||
public function query($query, $link = DatabaseInterface::CONNECT_USER, $options = 0,
|
||||
$cache_affected_rows = true
|
||||
) {
|
||||
$res = $this->tryQuery($query, $link, $options, $cache_affected_rows)
|
||||
@ -249,7 +261,7 @@ class DatabaseInterface
|
||||
* Stores query data into session data for debugging purposes
|
||||
*
|
||||
* @param string $query Query text
|
||||
* @param object $link database link
|
||||
* @param integer $link link type
|
||||
* @param object|boolean $result Query result
|
||||
* @param integer $time Time to execute query
|
||||
*
|
||||
@ -281,18 +293,17 @@ class DatabaseInterface
|
||||
* runs a query and returns the result
|
||||
*
|
||||
* @param string $query query to run
|
||||
* @param object $link mysql link resource
|
||||
* @param integer $link link type
|
||||
* @param integer $options query options
|
||||
* @param bool $cache_affected_rows whether to cache affected row
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function tryQuery($query, $link = null, $options = 0,
|
||||
public function tryQuery($query, $link = DatabaseInterface::CONNECT_USER, $options = 0,
|
||||
$cache_affected_rows = true
|
||||
) {
|
||||
$debug = $GLOBALS['cfg']['DBG']['sql'];
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -300,7 +311,7 @@ class DatabaseInterface
|
||||
$time = microtime(true);
|
||||
}
|
||||
|
||||
$result = $this->_extension->realQuery($query, $link, $options);
|
||||
$result = $this->_extension->realQuery($query, $this->_links[$link], $options);
|
||||
|
||||
if ($cache_affected_rows) {
|
||||
$GLOBALS['cached_affected_rows'] = $this->affectedRows($link, false);
|
||||
@ -312,7 +323,7 @@ class DatabaseInterface
|
||||
if ($GLOBALS['cfg']['DBG']['sqllog']) {
|
||||
if ($options & DatabaseInterface::QUERY_STORE == DatabaseInterface::QUERY_STORE) {
|
||||
$tmp = $this->_extension->realQuery('
|
||||
SHOW COUNT(*) WARNINGS', $link, DatabaseInterface::QUERY_STORE
|
||||
SHOW COUNT(*) WARNINGS', $this->_links[$link], DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$warnings = $this->fetchRow($tmp);
|
||||
} else {
|
||||
@ -345,14 +356,12 @@ class DatabaseInterface
|
||||
*
|
||||
* @return mysqli_result collection | boolean(false)
|
||||
*/
|
||||
public function tryMultiQuery($multi_query = '', $link = null)
|
||||
public function tryMultiQuery($multi_query = '', $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->_extension->realMultiQuery($link, $multi_query);
|
||||
return $this->_extension->realMultiQuery($this->_links[$link], $multi_query);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -363,7 +372,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @return array tables names
|
||||
*/
|
||||
public function getTables($database, $link = null)
|
||||
public function getTables($database, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$tables = $this->fetchResult(
|
||||
'SHOW TABLES FROM ' . Util::backquote($database) . ';',
|
||||
@ -485,21 +494,21 @@ class DatabaseInterface
|
||||
* @param string $database database
|
||||
* @param string|array $table table name(s)
|
||||
* @param boolean $tbl_is_group $table is a table group
|
||||
* @param mixed $link mysql link
|
||||
* @param integer $limit_offset zero-based offset for the count
|
||||
* @param boolean|integer $limit_count number of tables to return
|
||||
* @param string $sort_by table attribute to sort by
|
||||
* @param string $sort_order direction to sort (ASC or DESC)
|
||||
* @param string $table_type whether table or view
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @todo move into Table
|
||||
*
|
||||
* @return array list of tables in given db(s)
|
||||
*/
|
||||
public function getTablesFull($database, $table = '',
|
||||
$tbl_is_group = false, $link = null, $limit_offset = 0,
|
||||
$tbl_is_group = false, $limit_offset = 0,
|
||||
$limit_count = false, $sort_by = 'Name', $sort_order = 'ASC',
|
||||
$table_type = null
|
||||
$table_type = null, $link = DatabaseInterface::CONNECT_USER
|
||||
) {
|
||||
if (true === $limit_count) {
|
||||
$limit_count = $GLOBALS['cfg']['MaxTableList'];
|
||||
@ -798,7 +807,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @param string $database database
|
||||
* @param boolean $force_stats retrieve stats also for MySQL < 5
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
* @param string $sort_by column to order by
|
||||
* @param string $sort_order ASC or DESC
|
||||
* @param integer $limit_offset starting offset for LIMIT
|
||||
@ -810,7 +819,7 @@ class DatabaseInterface
|
||||
* @return array $databases
|
||||
*/
|
||||
public function getDatabasesFull($database = null, $force_stats = false,
|
||||
$link = null, $sort_by = 'SCHEMA_NAME', $sort_order = 'ASC',
|
||||
$link = DatabaseInterface::CONNECT_USER, $sort_by = 'SCHEMA_NAME', $sort_order = 'ASC',
|
||||
$limit_offset = 0, $limit_count = false
|
||||
) {
|
||||
$sort_order = strtoupper($sort_order);
|
||||
@ -1065,7 +1074,7 @@ class DatabaseInterface
|
||||
* @return array
|
||||
*/
|
||||
public function getColumnsFull($database = null, $table = null,
|
||||
$column = null, $link = null
|
||||
$column = null, $link = DatabaseInterface::CONNECT_USER
|
||||
) {
|
||||
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$sql_wheres = array();
|
||||
@ -1228,13 +1237,13 @@ class DatabaseInterface
|
||||
* @param string $table name of table to retrieve columns from
|
||||
* @param string $column name of column, null to show all columns
|
||||
* @param boolean $full whether to return full info or only column names
|
||||
* @param mixed $link mysql link resource
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return array array indexed by column names or,
|
||||
* if $column is given, flat array description
|
||||
*/
|
||||
public function getColumns($database, $table, $column = null, $full = false,
|
||||
$link = null
|
||||
$link = DatabaseInterface::CONNECT_USER
|
||||
) {
|
||||
$sql = $this->getColumnsSql($database, $table, $column, $full);
|
||||
$fields = $this->fetchResult($sql, 'Field', null, $link);
|
||||
@ -1277,7 +1286,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @return null|array
|
||||
*/
|
||||
public function getColumnNames($database, $table, $link = null)
|
||||
public function getColumnNames($database, $table, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$sql = $this->getColumnsSql($database, $table);
|
||||
// We only need the 'Field' column which contains the table's column names
|
||||
@ -1317,7 +1326,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @return array $indexes
|
||||
*/
|
||||
public function getTableIndexes($database, $table, $link = null)
|
||||
public function getTableIndexes($database, $table, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$sql = $this->getTableIndexesSql($database, $table);
|
||||
$indexes = $this->fetchResult($sql, null, null, $link);
|
||||
@ -1339,13 +1348,8 @@ class DatabaseInterface
|
||||
* @return mixed value for mysql server variable
|
||||
*/
|
||||
public function getVariable(
|
||||
$var, $type = self::GETVAR_SESSION, $link = null
|
||||
$var, $type = self::GETVAR_SESSION, $link = DatabaseInterface::CONNECT_USER
|
||||
) {
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case self::GETVAR_SESSION:
|
||||
$modifier = ' SESSION';
|
||||
@ -1370,12 +1374,8 @@ class DatabaseInterface
|
||||
*
|
||||
* @return bool whether query was a successful
|
||||
*/
|
||||
public function setVariable($var, $value, $link = null)
|
||||
public function setVariable($var, $value, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
$current_value = $this->getVariable(
|
||||
$var, self::GETVAR_SESSION, $link
|
||||
);
|
||||
@ -1404,7 +1404,7 @@ class DatabaseInterface
|
||||
* been established. It sets the connection collation, and determines the
|
||||
* version of MySQL which is running.
|
||||
*
|
||||
* @param mixed $link mysql link resource|object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -1534,12 +1534,12 @@ class DatabaseInterface
|
||||
* starting at 0, with 0 being default
|
||||
* @param integer|string $field field to fetch the value from,
|
||||
* starting at 0, with 0 being default
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return mixed value of first field in first row from result
|
||||
* or false if not found
|
||||
*/
|
||||
public function fetchValue($query, $row_number = 0, $field = 0, $link = null)
|
||||
public function fetchValue($query, $row_number = 0, $field = 0, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$value = false;
|
||||
|
||||
@ -1593,12 +1593,12 @@ class DatabaseInterface
|
||||
* @param string $query The query to execute
|
||||
* @param string $type NUM|ASSOC|BOTH returned array should either
|
||||
* numeric associative or both
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return array|boolean first row from result
|
||||
* or false if result is empty
|
||||
*/
|
||||
public function fetchSingleRow($query, $type = 'ASSOC', $link = null)
|
||||
public function fetchSingleRow($query, $type = 'ASSOC', $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$result = $this->tryQuery(
|
||||
$query,
|
||||
@ -1698,13 +1698,13 @@ class DatabaseInterface
|
||||
* or array of those
|
||||
* @param string|integer $value value-name or offset
|
||||
* used as value for array
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
* @param integer $options query options
|
||||
*
|
||||
* @return array resultrows or values indexed by $key
|
||||
*/
|
||||
public function fetchResult($query, $key = null, $value = null,
|
||||
$link = null, $options = 0
|
||||
$link = DatabaseInterface::CONNECT_USER, $options = 0
|
||||
) {
|
||||
$resultrows = array();
|
||||
|
||||
@ -1786,17 +1786,12 @@ class DatabaseInterface
|
||||
/**
|
||||
* returns warnings for last query
|
||||
*
|
||||
* @param object $link mysql link resource
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return array warnings
|
||||
*/
|
||||
public function getWarnings($link = null)
|
||||
public function getWarnings($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->fetchResult('SHOW WARNINGS', null, null, $link);
|
||||
}
|
||||
|
||||
@ -1805,11 +1800,11 @@ class DatabaseInterface
|
||||
*
|
||||
* @param string $db db name
|
||||
* @param string $which PROCEDURE | FUNCTION
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return array the procedure names or function names
|
||||
*/
|
||||
public function getProceduresOrFunctions($db, $which, $link = null)
|
||||
public function getProceduresOrFunctions($db, $which, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$shows = $this->fetchResult(
|
||||
'SHOW ' . $which . ' STATUS;', null, null, $link
|
||||
@ -1826,14 +1821,14 @@ class DatabaseInterface
|
||||
/**
|
||||
* returns the definition of a specific PROCEDURE, FUNCTION, EVENT or VIEW
|
||||
*
|
||||
* @param string $db db name
|
||||
* @param string $which PROCEDURE | FUNCTION | EVENT | VIEW
|
||||
* @param string $name the procedure|function|event|view name
|
||||
* @param object $link MySQL link
|
||||
* @param string $db db name
|
||||
* @param string $which PROCEDURE | FUNCTION | EVENT | VIEW
|
||||
* @param string $name the procedure|function|event|view name
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return string the definition
|
||||
*/
|
||||
public function getDefinition($db, $which, $name, $link = null)
|
||||
public function getDefinition($db, $which, $name, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$returned_field = array(
|
||||
'PROCEDURE' => 'Create Procedure',
|
||||
@ -2179,9 +2174,13 @@ class DatabaseInterface
|
||||
}
|
||||
|
||||
// when connection failed we don't have a $userlink
|
||||
if (! isset($GLOBALS['userlink'])) {
|
||||
Util::cacheSet('is_' . $type . 'user', false);
|
||||
return Util::cacheGet('is_' . $type . 'user');
|
||||
if (! isset($this->_links[DatabaseInterface::CONNECT_USER])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// checking if user is logged in
|
||||
if ($type === 'logged') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! $GLOBALS['cfg']['Server']['DisableIS'] || $type === 'super') {
|
||||
@ -2212,22 +2211,20 @@ class DatabaseInterface
|
||||
$is = false;
|
||||
$result = $this->tryQuery(
|
||||
$query,
|
||||
$GLOBALS['userlink'],
|
||||
self::CONNECT_USER,
|
||||
self::QUERY_STORE
|
||||
);
|
||||
if ($result) {
|
||||
$is = (bool) $this->numRows($result);
|
||||
}
|
||||
$this->freeResult($result);
|
||||
|
||||
Util::cacheSet('is_' . $type . 'user', $is);
|
||||
} else {
|
||||
$is = false;
|
||||
$grants = $this->fetchResult(
|
||||
"SHOW GRANTS FOR CURRENT_USER();",
|
||||
null,
|
||||
null,
|
||||
$GLOBALS['userlink'],
|
||||
self::CONNECT_USER,
|
||||
self::QUERY_STORE
|
||||
);
|
||||
if ($grants) {
|
||||
@ -2247,11 +2244,10 @@ class DatabaseInterface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Util::cacheSet('is_' . $type . 'user', $is);
|
||||
}
|
||||
|
||||
return Util::cacheGet('is_' . $type . 'user');
|
||||
Util::cacheSet('is_' . $type . 'user', $is);
|
||||
return $is;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2414,13 +2410,18 @@ class DatabaseInterface
|
||||
* @param integer $mode Connection mode on of CONNECT_USER, CONNECT_CONTROL
|
||||
* or CONNECT_AUXILIARY.
|
||||
* @param array|null $server Server information like host/port/socket/persistent
|
||||
* @param integer $target How to store connection link, defaults to $mode
|
||||
*
|
||||
* @return mixed false on error or a connection object on success
|
||||
*/
|
||||
public function connect($mode, $server = null)
|
||||
public function connect($mode, $server = null, $target = null)
|
||||
{
|
||||
list($user, $password, $server) = $this->getConnectionParams($mode, $server);
|
||||
|
||||
if (is_null($target)) {
|
||||
$target = $mode;
|
||||
}
|
||||
|
||||
if (is_null($user) || is_null($password)) {
|
||||
trigger_error(
|
||||
__('Missing connection parameters!'),
|
||||
@ -2437,9 +2438,10 @@ class DatabaseInterface
|
||||
$GLOBALS['error_handler']->setHideLocation(false);
|
||||
|
||||
if ($result) {
|
||||
$this->_links[$target] = $result;
|
||||
/* Run post connect for user connections */
|
||||
if ($mode == DatabaseInterface::CONNECT_USER) {
|
||||
$this->postConnect($result);
|
||||
if ($target == DatabaseInterface::CONNECT_USER) {
|
||||
$this->postConnect(DatabaseInterface::CONNECT_USER);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -2466,17 +2468,16 @@ class DatabaseInterface
|
||||
* selects given database
|
||||
*
|
||||
* @param string $dbname database name to select
|
||||
* @param object $link connection object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function selectDb($dbname, $link = null)
|
||||
public function selectDb($dbname, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->selectDb($dbname, $link);
|
||||
return $this->_extension->selectDb($dbname, $this->_links[$link]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2543,81 +2544,76 @@ class DatabaseInterface
|
||||
/**
|
||||
* Check if there are any more query results from a multi query
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return bool true or false
|
||||
*/
|
||||
public function moreResults($link = null)
|
||||
public function moreResults($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->moreResults($link);
|
||||
return $this->_extension->moreResults($this->_links[$link]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare next result from multi_query
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return bool true or false
|
||||
*/
|
||||
public function nextResult($link = null)
|
||||
public function nextResult($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->nextResult($link);
|
||||
return $this->_extension->nextResult($this->_links[$link]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the result returned from multi query
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return mixed false when empty results / result set when not empty
|
||||
*/
|
||||
public function storeResult($link = null)
|
||||
public function storeResult($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->storeResult($link);
|
||||
return $this->_extension->storeResult($this->_links[$link]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representing the type of connection used
|
||||
*
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return string type of connection used
|
||||
*/
|
||||
public function getHostInfo($link = null)
|
||||
public function getHostInfo($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->getHostInfo($link);
|
||||
return $this->_extension->getHostInfo($this->_links[$link]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the version of the MySQL protocol used
|
||||
*
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return integer version of the MySQL protocol used
|
||||
*/
|
||||
public function getProtoInfo($link = null)
|
||||
public function getProtoInfo($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->getProtoInfo($link);
|
||||
return $this->_extension->getProtoInfo($this->_links[$link]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2633,14 +2629,16 @@ class DatabaseInterface
|
||||
/**
|
||||
* returns last error message or false if no errors occurred
|
||||
*
|
||||
* @param object $link connection link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return string|bool $error or false
|
||||
*/
|
||||
public function getError($link = null)
|
||||
public function getError($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
return $this->_extension->getError($link);
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->getError($this->_links[$link]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2659,16 +2657,12 @@ class DatabaseInterface
|
||||
* returns last inserted auto_increment id for given $link
|
||||
* or $GLOBALS['userlink']
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return int|boolean
|
||||
*/
|
||||
public function insertId($link = null)
|
||||
public function insertId($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
// If the primary key is BIGINT we get an incorrect result
|
||||
// (sometimes negative, sometimes positive)
|
||||
// and in the present function we don't know if the PK is BIGINT
|
||||
@ -2683,22 +2677,21 @@ class DatabaseInterface
|
||||
/**
|
||||
* returns the number of rows affected by last query
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param integer $link link type
|
||||
* @param bool $get_from_cache whether to retrieve from cache
|
||||
*
|
||||
* @return int|boolean
|
||||
*/
|
||||
public function affectedRows($link = null, $get_from_cache = true)
|
||||
public function affectedRows($link = DatabaseInterface::CONNECT_USER, $get_from_cache = true)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($get_from_cache) {
|
||||
return $GLOBALS['cached_affected_rows'];
|
||||
} else {
|
||||
return $this->_extension->affectedRows($link);
|
||||
return $this->_extension->affectedRows($this->_links[$link]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2791,37 +2784,13 @@ class DatabaseInterface
|
||||
*
|
||||
* @return string a MySQL escaped string
|
||||
*/
|
||||
public function escapeString($str, $link = null)
|
||||
public function escapeString($str, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
if ($link === null) {
|
||||
$link = $this->getLink();
|
||||
}
|
||||
|
||||
if ($this->_extension === null) {
|
||||
if ($this->_extension === null || !isset($this->_links[$link])) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
return $this->_extension->escapeString($link, $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets correct link object.
|
||||
*
|
||||
* @param object $link optional database link to use
|
||||
*
|
||||
* @return object|boolean
|
||||
*/
|
||||
public function getLink($link = null)
|
||||
{
|
||||
if (! is_null($link) && $link !== false) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['userlink']) && !is_null($GLOBALS['userlink'])) {
|
||||
return $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->escapeString($this->_links[$link], $str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Display;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Encoding;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins;
|
||||
@ -274,7 +275,7 @@ class Export
|
||||
return $ret;
|
||||
}
|
||||
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($result, $GLOBALS['controllink'])) {
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($result, DatabaseInterface::CONNECT_CONTROL)) {
|
||||
$ret .= '<option value="' . htmlspecialchars($row['id']) . '"';
|
||||
if (!empty($_GET['template_id']) && $_GET['template_id'] == $row['id']) {
|
||||
$ret .= ' selected="selected"';
|
||||
@ -1110,7 +1111,7 @@ class Export
|
||||
|
||||
$response = Response::getInstance();
|
||||
if (! $result) {
|
||||
$error = $GLOBALS['dbi']->getError($GLOBALS['controllink']);
|
||||
$error = $GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL);
|
||||
$response->setRequestStatus(false);
|
||||
$response->addJSON('message', $error);
|
||||
exit;
|
||||
@ -1125,7 +1126,7 @@ class Export
|
||||
} elseif ('load' == $_REQUEST['templateAction']) {
|
||||
$data = null;
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc(
|
||||
$result, $GLOBALS['controllink']
|
||||
$result, DatabaseInterface::CONNECT_CONTROL
|
||||
)) {
|
||||
$data = $row['template_data'];
|
||||
}
|
||||
|
||||
@ -5370,7 +5370,7 @@ class Results
|
||||
|
||||
$dispresult = $GLOBALS['dbi']->tryQuery(
|
||||
$dispsql,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
|
||||
@ -242,10 +242,8 @@ class Footer
|
||||
if (! Core::isValid($_REQUEST['no_history'])
|
||||
&& empty($GLOBALS['error_message'])
|
||||
&& ! empty($GLOBALS['sql_query'])
|
||||
&& (isset($GLOBALS['dbi'])
|
||||
&& ($GLOBALS['dbi']->getLink()
|
||||
|| isset($GLOBALS['controllink'])
|
||||
&& $GLOBALS['controllink']))
|
||||
&& isset($GLOBALS['dbi'])
|
||||
&& $GLOBALS['dbi']->isUserType('logged')
|
||||
) {
|
||||
Relation::setHistory(
|
||||
Core::ifSetOr($GLOBALS['db'], ''),
|
||||
|
||||
@ -252,7 +252,7 @@ class Header
|
||||
'confirm' => $GLOBALS['cfg']['Confirm'],
|
||||
'LoginCookieValidity' => $GLOBALS['cfg']['LoginCookieValidity'],
|
||||
'session_gc_maxlifetime' => (int)@ini_get('session.gc_maxlifetime'),
|
||||
'logged_in' => isset($GLOBALS['userlink']) ? true : false,
|
||||
'logged_in' => $GLOBALS['dbi']->isUserType('logged'),
|
||||
'is_https' => $GLOBALS['PMA_Config']->isHttps(),
|
||||
'rootPath' => $GLOBALS['PMA_Config']->getRootPath(),
|
||||
'PMA_VERSION' => PMA_VERSION
|
||||
|
||||
@ -100,7 +100,9 @@ class InsertEdit
|
||||
. Util::backquote($table)
|
||||
. ' WHERE ' . $where_clause . ';';
|
||||
$result[$key_id] = $GLOBALS['dbi']->query(
|
||||
$local_query, null, DatabaseInterface::QUERY_STORE
|
||||
$local_query,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$rows[$key_id] = $GLOBALS['dbi']->fetchAssoc($result[$key_id]);
|
||||
|
||||
@ -179,7 +181,7 @@ class InsertEdit
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
'SELECT * FROM ' . Util::backquote($db)
|
||||
. '.' . Util::backquote($table) . ' LIMIT 1;',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$rows = array_fill(0, $GLOBALS['cfg']['InsertRows'], false);
|
||||
@ -2105,7 +2107,9 @@ class InsertEdit
|
||||
. ' WHERE ' . Util::backquote($foreigner['foreign_field'])
|
||||
. $where_comparison;
|
||||
$dispresult = $GLOBALS['dbi']->tryQuery(
|
||||
$dispsql, null, DatabaseInterface::QUERY_STORE
|
||||
$dispsql,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if ($dispresult && $GLOBALS['dbi']->numRows($dispresult) > 0) {
|
||||
list($dispval) = $GLOBALS['dbi']->fetchRow($dispresult, 0);
|
||||
|
||||
@ -16,7 +16,7 @@ require_once './libraries/check_user_privileges.inc.php';
|
||||
* handles database lists
|
||||
*
|
||||
* <code>
|
||||
* $ListDatabase = new ListDatabase($userlink);
|
||||
* $ListDatabase = new ListDatabase();
|
||||
* </code>
|
||||
*
|
||||
* @todo this object should be attached to the PMA_Server object
|
||||
@ -26,28 +26,11 @@ require_once './libraries/check_user_privileges.inc.php';
|
||||
*/
|
||||
class ListDatabase extends ListAbstract
|
||||
{
|
||||
/**
|
||||
* @var mixed database link resource|object to be used
|
||||
* @access protected
|
||||
*/
|
||||
protected $db_link = null;
|
||||
|
||||
/**
|
||||
* @var mixed user database link resource|object
|
||||
* @access protected
|
||||
*/
|
||||
protected $db_link_user = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed $db_link_user user database link resource|object
|
||||
*/
|
||||
public function __construct($db_link_user = null)
|
||||
public function __construct()
|
||||
{
|
||||
$this->db_link = $db_link_user;
|
||||
$this->db_link_user = $db_link_user;
|
||||
|
||||
parent::__construct();
|
||||
$this->build();
|
||||
}
|
||||
@ -103,7 +86,7 @@ class ListDatabase extends ListAbstract
|
||||
|
||||
if ($command) {
|
||||
$database_list = $GLOBALS['dbi']->fetchResult(
|
||||
$command, null, null, $this->db_link
|
||||
$command, null, null
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -557,7 +557,7 @@ class Menu
|
||||
'SHOW MASTER LOGS',
|
||||
'Log_name',
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
Util::cacheSet('binary_logs', $binary_logs);
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -823,7 +824,7 @@ class Node
|
||||
$sqlQuery,
|
||||
'db_name',
|
||||
'count',
|
||||
$GLOBALS['controllink']
|
||||
DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
return $counts;
|
||||
|
||||
@ -42,10 +42,10 @@ class Normalization
|
||||
$types = $GLOBALS['dbi']->types->getColumns();
|
||||
$columnTypeList = $types[$colTypeCategory];
|
||||
}
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
$columns = $GLOBALS['dbi']->getColumns(
|
||||
$db, $table, null,
|
||||
true, $GLOBALS['userlink']
|
||||
true
|
||||
);
|
||||
$type = "";
|
||||
$selectColHtml = "";
|
||||
@ -341,9 +341,9 @@ class Normalization
|
||||
}
|
||||
$key = implode(', ', $pk);
|
||||
if (count($primarycols) > 1) {
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
$columns = (array) $GLOBALS['dbi']->getColumnNames(
|
||||
$db, $table, $GLOBALS['userlink']
|
||||
$db, $table
|
||||
);
|
||||
if (count($pk) == count($columns)) {
|
||||
$headText = sprintf(
|
||||
@ -465,7 +465,7 @@ class Normalization
|
||||
);
|
||||
}
|
||||
$message = '';
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
foreach ($partialDependencies as $key=>$dependents) {
|
||||
if ($tablesName->$key != $table) {
|
||||
$backquotedKey = implode(', ', Util::backquote(explode(', ', $key)));
|
||||
@ -494,11 +494,11 @@ class Normalization
|
||||
$queries[] = 'DROP TABLE ' . Util::backquote($table);
|
||||
}
|
||||
foreach ($queries as $query) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['userlink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query)) {
|
||||
$message = Message::error(__('Error in processing!'));
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['userlink'])
|
||||
$GLOBALS['dbi']->getError()
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
@ -597,7 +597,7 @@ class Normalization
|
||||
);
|
||||
}
|
||||
$message = '';
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
foreach ($newTables as $originalTable=>$tablesList) {
|
||||
foreach ($tablesList as $table=>$cols) {
|
||||
if ($table != $originalTable) {
|
||||
@ -619,7 +619,7 @@ class Normalization
|
||||
}
|
||||
if ($dropCols) {
|
||||
$columns = (array) $GLOBALS['dbi']->getColumnNames(
|
||||
$db, $originalTable, $GLOBALS['userlink']
|
||||
$db, $originalTable
|
||||
);
|
||||
$colPresent = array_merge(
|
||||
explode(', ', $dropCols->pk), explode(', ', $dropCols->nonpk)
|
||||
@ -639,11 +639,11 @@ class Normalization
|
||||
$dropCols = false;
|
||||
}
|
||||
foreach ($queries as $query) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['userlink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query)) {
|
||||
$message = Message::error(__('Error in processing!'));
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['userlink'])
|
||||
$GLOBALS['dbi']->getError()
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
@ -703,13 +703,13 @@ class Normalization
|
||||
}
|
||||
$query2 = trim($query2, ',');
|
||||
$queries = array($query1, $query2);
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
foreach ($queries as $query) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['userlink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query)) {
|
||||
$message = Message::error(__('Error in processing!'));
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['userlink'])
|
||||
$GLOBALS['dbi']->getError()
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
@ -755,9 +755,9 @@ class Normalization
|
||||
foreach ($primarycols as $col) {
|
||||
$pk[] = $col->getName();
|
||||
}
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
$columns = (array) $GLOBALS['dbi']->getColumnNames(
|
||||
$db, $table, $GLOBALS['userlink']
|
||||
$db, $table
|
||||
);
|
||||
if (count($columns) - count($pk) <= 1) {
|
||||
continue;
|
||||
@ -851,9 +851,9 @@ class Normalization
|
||||
public static function findPartialDependencies($table, $db)
|
||||
{
|
||||
$dependencyList = array();
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
$columns = (array) $GLOBALS['dbi']->getColumnNames(
|
||||
$db, $table, $GLOBALS['userlink']
|
||||
$db, $table
|
||||
);
|
||||
$columns = (array)Util::backquote($columns);
|
||||
$totalRowsRes = $GLOBALS['dbi']->fetchResult(
|
||||
@ -932,7 +932,7 @@ class Normalization
|
||||
. 'COUNT(DISTINCT ' . $partialKey . ',' . $column . ') as pkColCnt '
|
||||
. 'FROM (SELECT * FROM ' . Util::backquote($table)
|
||||
. ' LIMIT 500) as dt' . ';';
|
||||
$res = $GLOBALS['dbi']->fetchResult($query, null, null, $GLOBALS['userlink']);
|
||||
$res = $GLOBALS['dbi']->fetchResult($query, null, null);
|
||||
$pkColCnt = $res[0];
|
||||
if ($pkCnt && $pkCnt == $colCnt && $colCnt == $pkColCnt) {
|
||||
return true;
|
||||
@ -965,7 +965,7 @@ class Normalization
|
||||
$query = trim($query, ', ');
|
||||
$query .= ' FROM (SELECT * FROM ' . Util::backquote($table)
|
||||
. ' LIMIT 500) as dt' . ';';
|
||||
$res = $GLOBALS['dbi']->fetchResult($query, null, null, $GLOBALS['userlink']);
|
||||
$res = $GLOBALS['dbi']->fetchResult($query, null, null);
|
||||
foreach ($columns as $column) {
|
||||
if ($column) {
|
||||
$result[$column] = $res[0][$column . '_cnt'];
|
||||
|
||||
@ -228,7 +228,7 @@ class ExportCsv extends ExportPlugin
|
||||
// Gets the data from the database
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
$fields_cnt = $GLOBALS['dbi']->numFields($result);
|
||||
|
||||
@ -223,7 +223,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
// Gets the data from the database
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
$fields_cnt = $GLOBALS['dbi']->numFields($result);
|
||||
|
||||
@ -236,7 +236,7 @@ class ExportJson extends ExportPlugin
|
||||
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
$columns_cnt = $GLOBALS['dbi']->numFields($result);
|
||||
|
||||
@ -309,7 +309,7 @@ class ExportLatex extends ExportPlugin
|
||||
|
||||
$result = $GLOBALS['dbi']->tryQuery(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
|
||||
|
||||
@ -330,7 +330,7 @@ class ExportMediawiki extends ExportPlugin
|
||||
// Get the table data from the database
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
$fields_cnt = $GLOBALS['dbi']->numFields($result);
|
||||
|
||||
@ -228,7 +228,7 @@ class ExportOds extends ExportPlugin
|
||||
// Gets the data from the database
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
$fields_cnt = $GLOBALS['dbi']->numFields($result);
|
||||
|
||||
@ -256,7 +256,7 @@ class ExportOdt extends ExportPlugin
|
||||
// Gets the data from the database
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
$fields_cnt = $GLOBALS['dbi']->numFields($result);
|
||||
|
||||
@ -182,7 +182,7 @@ class ExportPhparray extends ExportPlugin
|
||||
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
|
||||
|
||||
@ -1393,7 +1393,7 @@ class ExportSql extends ExportPlugin
|
||||
$result = $GLOBALS['dbi']->tryQuery(
|
||||
'SHOW TABLE STATUS FROM ' . Util::backquote($db)
|
||||
. ' WHERE Name = \'' . $GLOBALS['dbi']->escapeString($table) . '\'',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if ($result != false) {
|
||||
@ -2198,7 +2198,7 @@ class ExportSql extends ExportPlugin
|
||||
|
||||
$result = $GLOBALS['dbi']->tryQuery(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
// a possible error: the table has crashed
|
||||
|
||||
@ -199,7 +199,7 @@ class ExportTexytext extends ExportPlugin
|
||||
// Gets the data from the database
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
$fields_cnt = $GLOBALS['dbi']->numFields($result);
|
||||
|
||||
@ -480,7 +480,7 @@ class ExportXml extends ExportPlugin
|
||||
) {
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ class ExportYaml extends ExportPlugin
|
||||
$this->initAlias($aliases, $db_alias, $table_alias);
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
|
||||
|
||||
@ -673,7 +673,7 @@ class Pdf extends PdfLib
|
||||
*/
|
||||
$this->results = $GLOBALS['dbi']->query(
|
||||
$query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
$this->numFields = $GLOBALS['dbi']->numFields($this->results);
|
||||
@ -802,7 +802,7 @@ class Pdf extends PdfLib
|
||||
|
||||
$this->results = $GLOBALS['dbi']->query(
|
||||
$query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
$this->setY($this->tMargin);
|
||||
|
||||
@ -83,7 +83,9 @@ abstract class TableStats
|
||||
{
|
||||
$sql = 'DESCRIBE ' . Util::backquote($this->tableName);
|
||||
$result = $GLOBALS['dbi']->tryQuery(
|
||||
$sql, null, DatabaseInterface::QUERY_STORE
|
||||
$sql,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if (! $result || ! $GLOBALS['dbi']->numRows($result)) {
|
||||
$this->showMissingTableError();
|
||||
@ -149,7 +151,8 @@ abstract class TableStats
|
||||
{
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
'SHOW INDEX FROM ' . Util::backquote($this->tableName) . ';',
|
||||
null, DatabaseInterface::QUERY_STORE
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if ($GLOBALS['dbi']->numRows($result) > 0) {
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
|
||||
|
||||
@ -90,10 +90,10 @@ class PmdCommon
|
||||
$GLOBALS['dbi']->getColumnsSql(
|
||||
$GLOBALS['db'],
|
||||
$GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i],
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
true
|
||||
),
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$tbl_name_i = $GLOBALS['PMD']['TABLE_NAME'][$i];
|
||||
@ -122,7 +122,7 @@ class PmdCommon
|
||||
$i = 0;
|
||||
$alltab_rs = $GLOBALS['dbi']->query(
|
||||
'SHOW TABLES FROM ' . Util::backquote($GLOBALS['db']),
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
while ($val = @$GLOBALS['dbi']->fetchRow($alltab_rs)) {
|
||||
@ -269,7 +269,7 @@ class PmdCommon
|
||||
$query,
|
||||
'name',
|
||||
null,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
return $tab_pos;
|
||||
@ -297,7 +297,7 @@ class PmdCommon
|
||||
$query,
|
||||
null,
|
||||
null,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
return count($page_name) ? $page_name[0] : null;
|
||||
@ -361,7 +361,7 @@ class PmdCommon
|
||||
$query,
|
||||
null,
|
||||
null,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -401,7 +401,7 @@ class PmdCommon
|
||||
$query,
|
||||
null,
|
||||
null,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if (count($min_page_no[0])) {
|
||||
@ -634,7 +634,7 @@ class PmdCommon
|
||||
return array(true, __('Internal relationship has been added.'));
|
||||
}
|
||||
|
||||
$error = $GLOBALS['dbi']->getError($GLOBALS['controllink']);
|
||||
$error = $GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL);
|
||||
return array(
|
||||
false,
|
||||
__('Error: Internal relationship could not be added!')
|
||||
@ -705,7 +705,7 @@ class PmdCommon
|
||||
);
|
||||
|
||||
if (!$result) {
|
||||
$error = $GLOBALS['dbi']->getError($GLOBALS['controllink']);
|
||||
$error = $GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL);
|
||||
return array(
|
||||
false,
|
||||
__('Error: Internal relationship could not be removed!') . "<br/>" . $error
|
||||
@ -742,7 +742,7 @@ class PmdCommon
|
||||
. $GLOBALS['dbi']->escapeString($cfgDesigner['user']) . "';";
|
||||
|
||||
$orig_data = $GLOBALS['dbi']->fetchSingleRow(
|
||||
$orig_data_query, 'ASSOC', $GLOBALS['controllink']
|
||||
$orig_data_query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
if (! empty($orig_data)) {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -129,7 +130,7 @@ class RecentFavoriteTable
|
||||
json_encode($this->_tables)
|
||||
) . "')";
|
||||
|
||||
$success = $GLOBALS['dbi']->tryQuery($sql_query, $GLOBALS['controllink']);
|
||||
$success = $GLOBALS['dbi']->tryQuery($sql_query, DatabaseInterface::CONNECT_CONTROL);
|
||||
|
||||
if (! $success) {
|
||||
$error_msg = '';
|
||||
@ -145,7 +146,7 @@ class RecentFavoriteTable
|
||||
$message = Message::error($error_msg);
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
|
||||
$GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
|
||||
@ -48,14 +48,14 @@ class Relation
|
||||
if ($show_error) {
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
$options,
|
||||
$cache_affected_rows
|
||||
);
|
||||
} else {
|
||||
$result = @$GLOBALS['dbi']->tryQuery(
|
||||
$sql,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
$options,
|
||||
$cache_affected_rows
|
||||
);
|
||||
@ -497,9 +497,8 @@ class Relation
|
||||
|
||||
if ($GLOBALS['server'] == 0
|
||||
|| empty($GLOBALS['cfg']['Server']['pmadb'])
|
||||
|| empty($GLOBALS['controllink'])
|
||||
|| ! $GLOBALS['dbi']->selectDb(
|
||||
$GLOBALS['cfg']['Server']['pmadb'], $GLOBALS['controllink']
|
||||
$GLOBALS['cfg']['Server']['pmadb'], DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
) {
|
||||
// No server selected -> no bookmark table
|
||||
@ -728,13 +727,13 @@ class Relation
|
||||
),
|
||||
$query
|
||||
);
|
||||
$GLOBALS['dbi']->tryMultiQuery($query, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->tryMultiQuery($query, DatabaseInterface::CONNECT_CONTROL);
|
||||
// skips result sets of query as we are not interested in it
|
||||
while ($GLOBALS['dbi']->moreResults($GLOBALS['controllink'])
|
||||
&& $GLOBALS['dbi']->nextResult($GLOBALS['controllink'])
|
||||
while ($GLOBALS['dbi']->moreResults(DatabaseInterface::CONNECT_CONTROL)
|
||||
&& $GLOBALS['dbi']->nextResult(DatabaseInterface::CONNECT_CONTROL)
|
||||
) {
|
||||
}
|
||||
$error = $GLOBALS['dbi']->getError($GLOBALS['controllink']);
|
||||
$error = $GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL);
|
||||
// return true if no error exists otherwise false
|
||||
return empty($error);
|
||||
}
|
||||
@ -778,7 +777,7 @@ class Relation
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($column) . '\'';
|
||||
}
|
||||
$foreign = $GLOBALS['dbi']->fetchResult(
|
||||
$rel_query, 'master_field', null, $GLOBALS['controllink']
|
||||
$rel_query, 'master_field', null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
}
|
||||
|
||||
@ -854,7 +853,7 @@ class Relation
|
||||
. '\'';
|
||||
|
||||
$row = $GLOBALS['dbi']->fetchSingleRow(
|
||||
$disp_query, 'ASSOC', $GLOBALS['controllink']
|
||||
$disp_query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
if (isset($row['display_field'])) {
|
||||
return $row['display_field'];
|
||||
@ -1146,7 +1145,7 @@ class Relation
|
||||
ORDER BY `id` DESC';
|
||||
|
||||
return $GLOBALS['dbi']->fetchResult(
|
||||
$hist_query, null, null, $GLOBALS['controllink']
|
||||
$hist_query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
} // end of 'self::getHistory()' function
|
||||
|
||||
@ -1182,7 +1181,7 @@ class Relation
|
||||
LIMIT ' . $GLOBALS['cfg']['QueryHistoryMax'] . ', 1';
|
||||
|
||||
if ($max_time = $GLOBALS['dbi']->fetchValue(
|
||||
$search_query, 0, 0, $GLOBALS['controllink']
|
||||
$search_query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
)) {
|
||||
self::queryAsControlUser(
|
||||
'DELETE FROM '
|
||||
@ -1713,9 +1712,7 @@ class Relation
|
||||
. $GLOBALS['dbi']->escapeString($newpage) . '\')';
|
||||
self::queryAsControlUser($ins_query, false);
|
||||
|
||||
return $GLOBALS['dbi']->insertId(
|
||||
isset($GLOBALS['controllink']) ? $GLOBALS['controllink'] : ''
|
||||
);
|
||||
return $GLOBALS['dbi']->insertId(DatabaseInterface::CONNECT_CONTROL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1939,7 +1936,7 @@ class Relation
|
||||
'pma__export_templates' => 'export_templates',
|
||||
);
|
||||
|
||||
$existingTables = $GLOBALS['dbi']->getTables($db, $GLOBALS['controllink']);
|
||||
$existingTables = $GLOBALS['dbi']->getTables($db, DatabaseInterface::CONNECT_CONTROL);
|
||||
|
||||
$createQueries = null;
|
||||
$foundOne = false;
|
||||
|
||||
@ -134,7 +134,7 @@ class Privileges
|
||||
{
|
||||
$row1 = $GLOBALS['dbi']->fetchSingleRow(
|
||||
'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';',
|
||||
'ASSOC', $GLOBALS['userlink']
|
||||
'ASSOC'
|
||||
);
|
||||
// note: in MySQL 5.0.3 we get "Create View', 'Show view';
|
||||
// the View for Create is spelled with uppercase V
|
||||
@ -537,7 +537,7 @@ class Privileges
|
||||
$sql_query = "SELECT `usergroup` FROM " . $userTable
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username) . "'";
|
||||
$userGroup = $GLOBALS['dbi']->fetchValue(
|
||||
$sql_query, 0, 0, $GLOBALS['controllink']
|
||||
$sql_query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
}
|
||||
|
||||
@ -584,7 +584,7 @@ class Privileges
|
||||
$sql_query = "SELECT `usergroup` FROM " . $userTable
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username) . "'";
|
||||
$oldUserGroup = $GLOBALS['dbi']->fetchValue(
|
||||
$sql_query, 0, 0, $GLOBALS['controllink']
|
||||
$sql_query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
if ($oldUserGroup === false) {
|
||||
@ -2862,7 +2862,7 @@ class Privileges
|
||||
. '.' . Util::backquote($cfgRelation['usergroups']);
|
||||
$sql_query = 'SELECT COUNT(*) FROM ' . $user_group_table;
|
||||
$user_group_count = $GLOBALS['dbi']->fetchValue(
|
||||
$sql_query, 0, 0, $GLOBALS['controllink']
|
||||
$sql_query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
return $user_group_count;
|
||||
@ -2892,7 +2892,7 @@ class Privileges
|
||||
. ' LIMIT 1';
|
||||
|
||||
$usergroup = $GLOBALS['dbi']->fetchValue(
|
||||
$sql_query, 0, 0, $GLOBALS['controllink']
|
||||
$sql_query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
if ($usergroup === false) {
|
||||
@ -3456,7 +3456,7 @@ class Privileges
|
||||
} elseif ($type == 'table') {
|
||||
$result = @$GLOBALS['dbi']->tryQuery(
|
||||
"SHOW TABLES FROM " . Util::backquote($dbname),
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -3741,7 +3741,7 @@ class Privileges
|
||||
$initials = $GLOBALS['dbi']->tryQuery(
|
||||
'SELECT DISTINCT UPPER(LEFT(`User`,1)) FROM `user`'
|
||||
. ' ORDER BY UPPER(LEFT(`User`,1)) ASC',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if ($initials) {
|
||||
@ -3838,7 +3838,7 @@ class Privileges
|
||||
$drop_user_error = '';
|
||||
foreach ($queries as $sql_query) {
|
||||
if ($sql_query{0} != '#') {
|
||||
if (! $GLOBALS['dbi']->tryQuery($sql_query, $GLOBALS['userlink'])) {
|
||||
if (! $GLOBALS['dbi']->tryQuery($sql_query)) {
|
||||
$drop_user_error .= $GLOBALS['dbi']->getError() . "\n";
|
||||
}
|
||||
}
|
||||
@ -4623,10 +4623,14 @@ class Privileges
|
||||
$sql_query_all .= ' ;';
|
||||
|
||||
$res = $GLOBALS['dbi']->tryQuery(
|
||||
$sql_query, null, DatabaseInterface::QUERY_STORE
|
||||
$sql_query,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$res_all = $GLOBALS['dbi']->tryQuery(
|
||||
$sql_query_all, null, DatabaseInterface::QUERY_STORE
|
||||
$sql_query_all,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
if (! $res) {
|
||||
@ -4639,7 +4643,9 @@ class Privileges
|
||||
$GLOBALS['dbi']->freeResult($res_all);
|
||||
$sql_query = 'SELECT * FROM `mysql`.`user`';
|
||||
$res = $GLOBALS['dbi']->tryQuery(
|
||||
$sql_query, null, DatabaseInterface::QUERY_STORE
|
||||
$sql_query,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
if (! $res) {
|
||||
@ -4864,7 +4870,7 @@ class Privileges
|
||||
$res = $GLOBALS['dbi']->query(
|
||||
'SELECT `Db`, `Table_name`, `Table_priv` FROM `mysql`.`tables_priv`'
|
||||
. $user_host_condition,
|
||||
$GLOBALS['userlink'],
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
|
||||
@ -4881,7 +4887,7 @@ class Privileges
|
||||
. ' AND `Table_name`'
|
||||
. ' = \'' . $GLOBALS['dbi']->escapeString($row['Table_name']) . "'"
|
||||
. ';',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
|
||||
@ -503,7 +503,7 @@ EOT;
|
||||
$field_info_query,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -1033,7 +1033,7 @@ EOT;
|
||||
$querytime_before = array_sum(explode(' ', microtime()));
|
||||
|
||||
$result = @$GLOBALS['dbi']->tryQuery(
|
||||
$full_sql_query, null, DatabaseInterface::QUERY_STORE
|
||||
$full_sql_query, DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$querytime_after = array_sum(explode(' ', microtime()));
|
||||
|
||||
|
||||
@ -692,7 +692,7 @@ class Table
|
||||
'SELECT 1 FROM ' . Util::backquote($db) . '.'
|
||||
. Util::backquote($table) . ' LIMIT '
|
||||
. $GLOBALS['cfg']['MaxExactCountViews'],
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if (!$this->_dbi->getError()) {
|
||||
@ -1716,7 +1716,7 @@ class Table
|
||||
. "', '" . $GLOBALS['dbi']->escapeString($this->_name) . "', '"
|
||||
. $GLOBALS['dbi']->escapeString(json_encode($this->uiprefs)) . "')";
|
||||
|
||||
$success = $this->_dbi->tryQuery($sql_query, $GLOBALS['controllink']);
|
||||
$success = $this->_dbi->tryQuery($sql_query, DatabaseInterface::CONNECT_CONTROL);
|
||||
|
||||
if (!$success) {
|
||||
$message = Message::error(
|
||||
@ -1724,7 +1724,7 @@ class Table
|
||||
);
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$this->_dbi->getError($GLOBALS['controllink'])
|
||||
$this->_dbi->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
@ -1743,7 +1743,7 @@ class Table
|
||||
' ORDER BY last_update ASC' .
|
||||
' LIMIT ' . $num_rows_to_delete;
|
||||
$success = $this->_dbi->tryQuery(
|
||||
$sql_query, $GLOBALS['controllink']
|
||||
$sql_query, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
if (!$success) {
|
||||
@ -1758,7 +1758,7 @@ class Table
|
||||
);
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$this->_dbi->getError($GLOBALS['controllink'])
|
||||
$this->_dbi->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
@ -2147,7 +2147,7 @@ class Table
|
||||
if ($upd_query) {
|
||||
$this->_dbi->query(
|
||||
$upd_query,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
0,
|
||||
false
|
||||
);
|
||||
@ -2232,7 +2232,7 @@ class Table
|
||||
if (isset($upd_query)) {
|
||||
$this->_dbi->query(
|
||||
$upd_query,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
0,
|
||||
false
|
||||
);
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Plugins;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
use PhpMyAdmin\Relation;
|
||||
@ -148,7 +149,7 @@ class Tracker
|
||||
" AND table_name = '" . $GLOBALS['dbi']->escapeString($tablename) . "' " .
|
||||
" ORDER BY version DESC LIMIT 1";
|
||||
|
||||
$result = $GLOBALS['dbi']->fetchValue($sql_query, 0, 0, $GLOBALS['controllink']) == 1;
|
||||
$result = $GLOBALS['dbi']->fetchValue($sql_query, 0, 0, DatabaseInterface::CONNECT_CONTROL) == 1;
|
||||
|
||||
self::$_tracking_cache[$dbname][$tablename] = $result;
|
||||
|
||||
|
||||
@ -279,7 +279,7 @@ class Transformations
|
||||
OR `input_transformation` != \'\'
|
||||
OR `input_transformation_options` != \'\'' : '') . ')';
|
||||
$result = $GLOBALS['dbi']->fetchResult(
|
||||
$com_qry, 'column_name', null, $GLOBALS['controllink']
|
||||
$com_qry, 'column_name', null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
foreach ($result as $column => $values) {
|
||||
|
||||
@ -77,7 +77,7 @@ class UserPreferences
|
||||
. ' WHERE `username` = \''
|
||||
. $GLOBALS['dbi']->escapeString($cfgRelation['user'])
|
||||
. '\'';
|
||||
$row = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', $GLOBALS['controllink']);
|
||||
$row = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL);
|
||||
|
||||
return array(
|
||||
'config_data' => $row ? (array)json_decode($row['config_data']) : array(),
|
||||
@ -119,7 +119,7 @@ class UserPreferences
|
||||
. '\'';
|
||||
|
||||
$has_config = $GLOBALS['dbi']->fetchValue(
|
||||
$query, 0, 0, $GLOBALS['controllink']
|
||||
$query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
$config_data = json_encode($config_array);
|
||||
if ($has_config) {
|
||||
@ -140,11 +140,11 @@ class UserPreferences
|
||||
if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
|
||||
unset($_SESSION['cache'][$cache_key]['userprefs']);
|
||||
}
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, DatabaseInterface::CONNECT_CONTROL)) {
|
||||
$message = Message::error(__('Could not save configuration'));
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
|
||||
$GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
|
||||
@ -751,7 +751,6 @@ class Util
|
||||
$db,
|
||||
'',
|
||||
false,
|
||||
null,
|
||||
$limit_offset,
|
||||
$limit_count
|
||||
);
|
||||
@ -4506,7 +4505,7 @@ class Util
|
||||
// include the table with the exact name of the group if such
|
||||
// exists
|
||||
$groupTable = $GLOBALS['dbi']->getTablesFull(
|
||||
$db, $tbl_group, false, null, $limit_offset,
|
||||
$db, $tbl_group, false, $limit_offset,
|
||||
$limit_count, $sort, $sort_order, $tbl_type
|
||||
);
|
||||
$groupWithSeparator = $tbl_group
|
||||
@ -4535,7 +4534,7 @@ class Util
|
||||
$tables = array_merge(
|
||||
$groupTable,
|
||||
$GLOBALS['dbi']->getTablesFull(
|
||||
$db, $groupWithSeparator, ($groupWithSeparator !== false), null,
|
||||
$db, $groupWithSeparator, ($groupWithSeparator !== false),
|
||||
$limit_offset, $limit_count, $sort, $sort_order, $tbl_type
|
||||
)
|
||||
);
|
||||
|
||||
@ -538,7 +538,11 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
* and phpMyAdmin issuing queries to configuration storage, which
|
||||
* is not locked by that time.
|
||||
*/
|
||||
$controllink = $GLOBALS['dbi']->connect(DatabaseInterface::CONNECT_USER);
|
||||
$controllink = $GLOBALS['dbi']->connect(
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
}
|
||||
|
||||
$auth_plugin->rememberCredentials();
|
||||
@ -564,8 +568,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
* the DatabaseList class as a stub for the ListDatabase class
|
||||
*/
|
||||
$dblist = new DatabaseList();
|
||||
$dblist->userlink = $userlink;
|
||||
$dblist->controllink = $controllink;
|
||||
|
||||
/**
|
||||
* some resetting has to be done when switching servers
|
||||
|
||||
@ -67,7 +67,8 @@ if (empty($is_table)
|
||||
$_result = $GLOBALS['dbi']->tryQuery(
|
||||
'SHOW TABLES LIKE \''
|
||||
. $GLOBALS['dbi']->escapeString($table) . '\';',
|
||||
null, PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
PhpMyAdmin\DatabaseInterface::CONNECT_USER,
|
||||
PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$is_table = @$GLOBALS['dbi']->numRows($_result);
|
||||
$GLOBALS['dbi']->freeResult($_result);
|
||||
@ -90,7 +91,7 @@ if (empty($is_table)
|
||||
$_result = $GLOBALS['dbi']->tryQuery(
|
||||
'SELECT COUNT(*) FROM ' . PhpMyAdmin\Util::backquote($table)
|
||||
. ';',
|
||||
null,
|
||||
PhpMyAdmin\DatabaseInterface::CONNECT_USER,
|
||||
PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$is_table = ($_result && @$GLOBALS['dbi']->numRows($_result));
|
||||
|
||||
@ -875,6 +875,4 @@ $GLOBALS['dummy_queries'] = array(
|
||||
$GLOBALS['dummy_db'] = '';
|
||||
|
||||
/* Some basic setup for dummy driver */
|
||||
$GLOBALS['userlink'] = 1;
|
||||
$GLOBALS['controllink'] = 2;
|
||||
$GLOBALS['cfg']['DBG']['sql'] = false;
|
||||
|
||||
@ -39,5 +39,5 @@ $GLOBALS['is_createuser'] = $GLOBALS['dbi']->isUserType('create');
|
||||
|
||||
// now, select the mysql db
|
||||
if ($GLOBALS['dbi']->isSuperuser()) {
|
||||
$GLOBALS['dbi']->selectDb('mysql', $GLOBALS['userlink']);
|
||||
$GLOBALS['dbi']->selectDb('mysql');
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ if ($foreign_db) {
|
||||
|
||||
$tables_rs = $GLOBALS['dbi']->query(
|
||||
'SHOW TABLE STATUS FROM ' . Util::backquote($foreign_db),
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
while ($row = $GLOBALS['dbi']->fetchRow($tables_rs)) {
|
||||
|
||||
@ -90,6 +90,7 @@ $_SESSION[' PMA_token '] = 'token';
|
||||
$GLOBALS['PMA_Theme'] = PhpMyAdmin\Theme::load('./themes/pmahomme');
|
||||
$_SESSION['tmpval']['pftext'] = 'F';
|
||||
$GLOBALS['lang'] = 'en';
|
||||
$GLOBALS['PMA_Config'] = new PhpMyAdmin\Config();
|
||||
|
||||
// Check whether we have runkit extension
|
||||
define('PMA_HAS_RUNKIT', function_exists('runkit_constant_redefine'));
|
||||
|
||||
@ -9,6 +9,7 @@ namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\CentralColumns;
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Types;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -180,7 +181,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT count(db_name) FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'phpmyadmin';",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array(3))
|
||||
@ -223,7 +224,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT col_name FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'PMA_db' AND col_name IN ('col1');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array('col1'))
|
||||
@ -234,7 +235,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"DELETE FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'PMA_db' AND col_name IN ('col1');",
|
||||
$GLOBALS['controllink']
|
||||
DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array('col1'))
|
||||
@ -291,7 +292,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT col_name FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'PMA_db' AND col_name IN ('id','col1','col2');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array('id','col1'))
|
||||
@ -317,7 +318,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT * FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'PMA_db' AND col_name IN ('id','col1','col2');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array_slice($this->_columnData, 0, 2))
|
||||
@ -381,7 +382,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT * FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'phpmyadmin' AND col_name IN ('col1','col2');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue($this->_columnData)
|
||||
@ -485,7 +486,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT * FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'phpmyadmin';",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue($this->_columnData)
|
||||
@ -509,7 +510,7 @@ class CentralColumnsTest extends TestCase
|
||||
"SELECT * FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'phpmyadmin' AND col_name "
|
||||
. "NOT IN ('id','col1','col2');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue($this->_columnData)
|
||||
@ -572,7 +573,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT * FROM `pma_central_columns` WHERE db_name = 'phpmyadmin'"
|
||||
. " AND col_name IN ('col1');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array_slice($this->_columnData, 1, 1))
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Controllers\Server;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Di\Container;
|
||||
use PhpMyAdmin\Tests\PmaTestCase;
|
||||
use PhpMyAdmin\Tests\Stubs\Response as ResponseStub;
|
||||
@ -69,7 +70,7 @@ class ServerVariablesControllerTest extends PmaTestCase
|
||||
"SHOW SESSION VARIABLES;",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_session_variable
|
||||
),
|
||||
@ -77,7 +78,7 @@ class ServerVariablesControllerTest extends PmaTestCase
|
||||
"SHOW GLOBAL VARIABLES;",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_global_variables
|
||||
)
|
||||
|
||||
@ -63,7 +63,7 @@ class DesignerTest extends TestCase
|
||||
->with(
|
||||
"SELECT `page_nr`, `page_descr` FROM `pmadb`.`pdf_pages`"
|
||||
. " WHERE db_name = '" . $db . "' ORDER BY `page_descr`",
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE,
|
||||
false
|
||||
)
|
||||
|
||||
@ -246,7 +246,6 @@ class DbiMysqlTest extends PmaTestCase
|
||||
{
|
||||
$this->markTestIncomplete('Not testing anything');
|
||||
//$link is empty
|
||||
$GLOBALS['userlink'] = null;
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$this->object->selectDb("PMA", null)
|
||||
|
||||
@ -214,7 +214,6 @@ class DbiMysqliTest extends PmaTestCase
|
||||
{
|
||||
$this->markTestIncomplete('Not testing anything');
|
||||
//$link is empty
|
||||
$GLOBALS['userlink'] = null;
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$this->object->selectDb("PMA", null)
|
||||
|
||||
@ -236,7 +236,7 @@ class InsertEditTest extends TestCase
|
||||
->method('query')
|
||||
->with(
|
||||
'SELECT * FROM `db`.`table` LIMIT 1;',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
)
|
||||
->will($this->returnValue('result1'));
|
||||
@ -2232,7 +2232,7 @@ class InsertEditTest extends TestCase
|
||||
->with(
|
||||
'SELECT `TABLE_COMMENT` FROM `information_schema`.`TABLES` WHERE '
|
||||
. '`f`=1',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
)
|
||||
->will($this->returnValue('r1'));
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Normalization;
|
||||
use PhpMyAdmin\Theme;
|
||||
use PhpMyAdmin\Types;
|
||||
@ -67,13 +68,13 @@ class NormalizationTest extends TestCase
|
||||
->method('getColumnNames')
|
||||
->will($this->returnValue(array("id", "col1", "col2")));
|
||||
$map = array(
|
||||
array('PMA_db', 'PMA_table1', null, array()),
|
||||
array('PMA_db', 'PMA_table1', DatabaseInterface::CONNECT_USER, array()),
|
||||
array(
|
||||
'PMA_db', 'PMA_table', null,
|
||||
'PMA_db', 'PMA_table', DatabaseInterface::CONNECT_USER,
|
||||
array(array('Key_name'=>'PRIMARY', 'Column_name'=>'id'))
|
||||
),
|
||||
array(
|
||||
'PMA_db', 'PMA_table2', null,
|
||||
'PMA_db', 'PMA_table2', DatabaseInterface::CONNECT_USER,
|
||||
array(
|
||||
array('Key_name'=>'PRIMARY', 'Column_name'=>'id'),
|
||||
array('Key_name'=>'PRIMARY', 'Column_name'=>'col1')
|
||||
|
||||
@ -507,7 +507,7 @@ class ExportCsvTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('test', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('test', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -560,7 +560,7 @@ class ExportCsvTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('test', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('test', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -607,7 +607,7 @@ class ExportCsvTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('test', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('test', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -657,7 +657,7 @@ class ExportCsvTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('test', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('test', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -706,7 +706,7 @@ class ExportCsvTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('test', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('test', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
|
||||
@ -339,7 +339,7 @@ class ExportHtmlwordTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('test', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('test', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -532,7 +532,6 @@ class ExportHtmlwordTest extends PmaTestCase
|
||||
->will($this->returnValue(1));
|
||||
|
||||
$GLOBALS['cfgRelation']['relation'] = true;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$_SESSION['relation'][0] = array(
|
||||
'PMA_VERSION' => PMA_VERSION,
|
||||
'relwork' => true,
|
||||
|
||||
@ -350,7 +350,7 @@ class ExportMediawikiTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
|
||||
@ -330,7 +330,7 @@ class ExportOdsTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -407,7 +407,7 @@ class ExportOdsTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -468,7 +468,7 @@ class ExportOdsTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
|
||||
@ -447,7 +447,7 @@ class ExportOdtTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -521,7 +521,7 @@ class ExportOdtTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -582,7 +582,7 @@ class ExportOdtTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -744,7 +744,6 @@ class ExportOdtTest extends PmaTestCase
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col'
|
||||
);
|
||||
$GLOBALS['controllink'] = null;
|
||||
$this->assertTrue(
|
||||
$this->object->getTableDef(
|
||||
'database',
|
||||
|
||||
@ -215,7 +215,7 @@ class ExportPhparrayTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -268,7 +268,7 @@ class ExportPhparrayTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
|
||||
@ -42,7 +42,6 @@ class ExportSqlTest extends PmaTestCase
|
||||
$GLOBALS['plugin_param']['export_type'] = 'table';
|
||||
$GLOBALS['plugin_param']['single_table'] = false;
|
||||
$GLOBALS['cfgRelation']['relation'] = true;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$this->object = new ExportSql();
|
||||
}
|
||||
|
||||
@ -712,8 +711,8 @@ class ExportSqlTest extends PmaTestCase
|
||||
->will(
|
||||
$this->returnValueMap(
|
||||
array(
|
||||
array('db', 'EVENT', 'f1', null, 'f1event'),
|
||||
array('db', 'EVENT', 'f2', null, 'f2event')
|
||||
array('db', 'EVENT', 'f1', DatabaseInterface::CONNECT_USER, 'f1event'),
|
||||
array('db', 'EVENT', 'f2', DatabaseInterface::CONNECT_USER, 'f2event')
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -1481,7 +1480,7 @@ class ExportSqlTest extends PmaTestCase
|
||||
->method('tryQuery')
|
||||
->with(
|
||||
"SELECT a FROM b WHERE 1",
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
)
|
||||
->will($this->returnValue('res'));
|
||||
@ -1612,7 +1611,7 @@ class ExportSqlTest extends PmaTestCase
|
||||
->method('tryQuery')
|
||||
->with(
|
||||
"SELECT a FROM b WHERE 1",
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
)
|
||||
->will($this->returnValue('res'));
|
||||
|
||||
@ -242,7 +242,7 @@ class ExportTexytextTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
@ -363,7 +363,6 @@ class ExportTexytextTest extends PmaTestCase
|
||||
$this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Export\ExportTexytext')
|
||||
->setMethods(array('formatOneColumnDefinition'))
|
||||
->getMock();
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
// case 1
|
||||
|
||||
|
||||
@ -490,7 +490,7 @@ class ExportXmlTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
|
||||
@ -204,7 +204,7 @@ class ExportYamlTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('query')
|
||||
->with('SELECT', null, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->with('SELECT', DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_UNBUFFERED)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
|
||||
@ -41,7 +41,6 @@ class DiaRelationSchemaTest extends PmaTestCase
|
||||
$_REQUEST['t_y'] = array('information_schema.files' => 0);
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
|
||||
|
||||
@ -42,7 +42,6 @@ class EpsRelationSchemaTest extends PmaTestCase
|
||||
$_REQUEST['t_y'] = array('information_schema.files' => 0);
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
|
||||
|
||||
@ -45,7 +45,6 @@ class PdfRelationSchemaTest extends PmaTestCase
|
||||
$_REQUEST['t_y'] = array('information_schema.files' => 0);
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['Server']['pmadb'] = "pmadb";
|
||||
$GLOBALS['cfg']['Server']['user'] = "user";
|
||||
|
||||
@ -41,7 +41,6 @@ class SvgRelationSchemaTest extends PmaTestCase
|
||||
$_REQUEST['t_y'] = array('information_schema.files' => 0);
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@ class PmdCommonTest extends TestCase
|
||||
public function setup()
|
||||
{
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = 2;
|
||||
$_SESSION = array(
|
||||
'relation' => array(
|
||||
'1' => array(
|
||||
@ -68,7 +67,7 @@ class PmdCommonTest extends TestCase
|
||||
WHERE pdf_page_number = " . $pg,
|
||||
'name',
|
||||
null,
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
@ -99,7 +98,7 @@ class PmdCommonTest extends TestCase
|
||||
. " WHERE `page_nr` = " . $pg,
|
||||
null,
|
||||
null,
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
)
|
||||
->will($this->returnValue(array($pageName)));
|
||||
@ -161,7 +160,7 @@ class PmdCommonTest extends TestCase
|
||||
. " AND `page_descr` = '" . $db . "'",
|
||||
null,
|
||||
null,
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
)
|
||||
->will($this->returnValue(array($default_pg)));
|
||||
@ -195,7 +194,7 @@ class PmdCommonTest extends TestCase
|
||||
. " AND `page_descr` = '" . $db . "'",
|
||||
null,
|
||||
null,
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
)
|
||||
->will($this->returnValue(array()));
|
||||
@ -230,7 +229,7 @@ class PmdCommonTest extends TestCase
|
||||
. " AND `page_descr` = '" . $db . "'",
|
||||
null,
|
||||
null,
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
)
|
||||
->will($this->returnValue(array($default_pg)));
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\ReplicationGui;
|
||||
use PhpMyAdmin\Theme;
|
||||
use PHPUnit_Framework_TestCase as TestCase;
|
||||
@ -66,7 +67,7 @@ class ReplicationGuiTest extends TestCase
|
||||
"SHOW SLAVE HOSTS",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$slave_host
|
||||
),
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Tests\Rte;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Rte\Routines;
|
||||
use PhpMyAdmin\Types;
|
||||
@ -1106,9 +1107,9 @@ class RoutinesTest extends TestCase
|
||||
->will(
|
||||
$this->returnValueMap(
|
||||
array(
|
||||
array('foo', null, 'foo'),
|
||||
array("foo's bar", null, "foo\'s bar"),
|
||||
array('', null, '')
|
||||
array('foo', DatabaseInterface::CONNECT_USER, 'foo'),
|
||||
array("foo's bar", DatabaseInterface::CONNECT_USER, "foo\'s bar"),
|
||||
array('', DatabaseInterface::CONNECT_USER, '')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status\Advisor;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Theme;
|
||||
@ -88,7 +89,7 @@ class AdvisorTest extends TestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -96,7 +97,7 @@ class AdvisorTest extends TestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
),
|
||||
@ -105,7 +106,7 @@ class AdvisorTest extends TestCase
|
||||
. "FROM data_dictionary.GLOBAL_STATEMENTS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Tests\PmaTestCase;
|
||||
|
||||
@ -71,7 +72,7 @@ class DataTest extends PmaTestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -79,7 +80,7 @@ class DataTest extends PmaTestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
),
|
||||
@ -88,7 +89,7 @@ class DataTest extends PmaTestCase
|
||||
. "FROM data_dictionary.GLOBAL_STATEMENTS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status\Monitor;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Theme;
|
||||
@ -83,7 +84,7 @@ class MonitorTest extends TestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -91,7 +92,7 @@ class MonitorTest extends TestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
),
|
||||
@ -100,7 +101,7 @@ class MonitorTest extends TestCase
|
||||
. "FROM data_dictionary.GLOBAL_STATEMENTS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Server\Status\Queries;
|
||||
use PhpMyAdmin\Theme;
|
||||
@ -83,7 +84,7 @@ class QueriesTest extends TestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -91,7 +92,7 @@ class QueriesTest extends TestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
)
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Server\Status\Variables;
|
||||
use PhpMyAdmin\Theme;
|
||||
@ -84,7 +85,7 @@ class VariablesTest extends TestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -92,7 +93,7 @@ class VariablesTest extends TestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
),
|
||||
@ -101,7 +102,7 @@ class VariablesTest extends TestCase
|
||||
. "FROM data_dictionary.GLOBAL_STATEMENTS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Theme;
|
||||
@ -77,7 +78,7 @@ class StatusTest extends TestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -85,7 +86,7 @@ class StatusTest extends TestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
),
|
||||
@ -94,7 +95,7 @@ class StatusTest extends TestCase
|
||||
. "FROM data_dictionary.GLOBAL_STATEMENTS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
|
||||
@ -85,7 +85,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_isView_true,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
true
|
||||
),
|
||||
@ -93,7 +93,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_copy_data,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
false
|
||||
),
|
||||
@ -101,7 +101,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_isView_false,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
false
|
||||
),
|
||||
@ -109,7 +109,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_isUpdatableView_true,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
true
|
||||
),
|
||||
@ -117,7 +117,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_isUpdatableView_false,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
false
|
||||
),
|
||||
@ -125,7 +125,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_analyzeStructure_true,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
array(
|
||||
array('COLUMN_NAME'=>'COLUMN_NAME', 'DATA_TYPE'=>'DATA_TYPE')
|
||||
@ -135,7 +135,7 @@ class TableTest extends PmaTestCase
|
||||
$getUniqueColumns_sql,
|
||||
array('Key_name', null),
|
||||
'Column_name',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
array(
|
||||
array('index1'),
|
||||
@ -147,7 +147,7 @@ class TableTest extends PmaTestCase
|
||||
$getUniqueColumns_sql,
|
||||
'Column_name',
|
||||
'Column_name',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
array(
|
||||
'column1',
|
||||
@ -162,7 +162,7 @@ class TableTest extends PmaTestCase
|
||||
'SHOW COLUMNS FROM `PMA`.`PMA_BookMark`',
|
||||
'Field',
|
||||
'Field',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
array(
|
||||
'column1',
|
||||
@ -177,7 +177,7 @@ class TableTest extends PmaTestCase
|
||||
'SHOW COLUMNS FROM `PMA`.`PMA_BookMark`',
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
array(
|
||||
array(
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Tests\PmaTestCase;
|
||||
use PhpMyAdmin\Tracker;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -291,12 +292,10 @@ class TrackerTest extends PmaTestCase
|
||||
"\n',
|
||||
'11' )";
|
||||
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$queryResults = array(
|
||||
array(
|
||||
$expectedMainQuery,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
0,
|
||||
false,
|
||||
'executed'
|
||||
@ -382,11 +381,9 @@ class TrackerTest extends PmaTestCase
|
||||
"\n',
|
||||
'CREATE DATABASE,ALTER DATABASE,DROP DATABASE' )";
|
||||
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$dbi->expects($this->exactly(1))
|
||||
->method('query')
|
||||
->with($expectedMainQuery, null, 0, false)
|
||||
->with($expectedMainQuery, DatabaseInterface::CONNECT_CONTROL, 0, false)
|
||||
->will($this->returnValue("executed"));
|
||||
|
||||
$dbi->expects($this->any())->method('escapeString')
|
||||
@ -427,11 +424,9 @@ class TrackerTest extends PmaTestCase
|
||||
" AND `table_name` = '" . $tablename . "' " .
|
||||
" AND `version` = '" . $version . "' ";
|
||||
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$dbi->expects($this->exactly(1))
|
||||
->method('query')
|
||||
->with($sql_query, null, 0, false)
|
||||
->with($sql_query, DatabaseInterface::CONNECT_CONTROL, 0, false)
|
||||
->will($this->returnValue("executed"));
|
||||
|
||||
$dbi->expects($this->any())->method('escapeString')
|
||||
@ -473,8 +468,6 @@ class TrackerTest extends PmaTestCase
|
||||
Tracker::changeTrackingData("", "", "", "", "")
|
||||
);
|
||||
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -509,8 +502,8 @@ class TrackerTest extends PmaTestCase
|
||||
->will(
|
||||
$this->returnValueMap(
|
||||
array(
|
||||
array($sql_query_1, null, 0, false, "executed_1"),
|
||||
array($sql_query_2, null, 0, false, "executed_2")
|
||||
array($sql_query_1, DatabaseInterface::CONNECT_CONTROL, 0, false, "executed_1"),
|
||||
array($sql_query_2, DatabaseInterface::CONNECT_CONTROL, 0, false, "executed_2")
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -577,8 +570,6 @@ class TrackerTest extends PmaTestCase
|
||||
*/
|
||||
public function testGetTrackedData($fetchArrayReturn, $expectedArray)
|
||||
{
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\Config\ConfigFile;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Tests\PmaTestCase;
|
||||
use PhpMyAdmin\UserPreferences;
|
||||
|
||||
@ -29,6 +30,7 @@ class UserPreferencesTest extends PmaTestCase
|
||||
include 'libraries/config.default.php';
|
||||
$GLOBALS['server'] = 0;
|
||||
$GLOBALS['PMA_PHP_SELF'] = '/phpmyadmin/';
|
||||
$GLOBALS['collation_connection'] = 'utf8_general_ci';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +102,6 @@ class UserPreferencesTest extends PmaTestCase
|
||||
$_SESSION['relation'][$GLOBALS['server']]['db'] = "pma'db";
|
||||
$_SESSION['relation'][$GLOBALS['server']]['userconfig'] = "testconf";
|
||||
$_SESSION['relation'][$GLOBALS['server']]['user'] = "user";
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
@ -111,7 +112,7 @@ class UserPreferencesTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('fetchSingleRow')
|
||||
->with($query, 'ASSOC', null)
|
||||
->with($query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL)
|
||||
->will(
|
||||
$this->returnValue(
|
||||
array(
|
||||
@ -189,7 +190,6 @@ class UserPreferencesTest extends PmaTestCase
|
||||
$_SESSION['relation'][$GLOBALS['server']]['db'] = "pmadb";
|
||||
$_SESSION['relation'][$GLOBALS['server']]['userconfig'] = "testconf";
|
||||
$_SESSION['relation'][$GLOBALS['server']]['user'] = "user";
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$query1 = 'SELECT `username` FROM `pmadb`.`testconf` '
|
||||
. 'WHERE `username` = \'user\'';
|
||||
@ -203,12 +203,12 @@ class UserPreferencesTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('fetchValue')
|
||||
->with($query1, 0, 0, null)
|
||||
->with($query1, 0, 0, DatabaseInterface::CONNECT_CONTROL)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('tryQuery')
|
||||
->with($query2, null)
|
||||
->with($query2, DatabaseInterface::CONNECT_CONTROL)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->any())
|
||||
@ -234,17 +234,17 @@ class UserPreferencesTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('fetchValue')
|
||||
->with($query1, 0, 0, null)
|
||||
->with($query1, 0, 0, DatabaseInterface::CONNECT_CONTROL)
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('tryQuery')
|
||||
->with($query2, null)
|
||||
->with($query2, DatabaseInterface::CONNECT_CONTROL)
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('getError')
|
||||
->with(null)
|
||||
->with(DatabaseInterface::CONNECT_CONTROL)
|
||||
->will($this->returnValue("err1"));
|
||||
$dbi->expects($this->any())
|
||||
->method('escapeString')
|
||||
@ -355,7 +355,7 @@ class UserPreferencesTest extends PmaTestCase
|
||||
{
|
||||
$GLOBALS['lang'] = '';
|
||||
|
||||
$this->mockResponse('Location: /phpmyadmin/file.html?a=b&saved=1&server=0#h+ash');
|
||||
$this->mockResponse('Location: /phpmyadmin/file.html?a=b&saved=1&server=0&collation_connection=utf8_general_ci#h+ash');
|
||||
|
||||
$GLOBALS['PMA_Config']->set('PmaAbsoluteUri', '');
|
||||
$GLOBALS['PMA_Config']->set('PMA_IS_IIS', false);
|
||||
|
||||
@ -65,14 +65,14 @@ if (isset($where_clause)) {
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
'SELECT * FROM ' . PhpMyAdmin\Util::backquote($table)
|
||||
. ' WHERE ' . $where_clause . ';',
|
||||
null,
|
||||
PhpMyAdmin\DatabaseInterface::CONNECT_USER,
|
||||
PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$row = $GLOBALS['dbi']->fetchAssoc($result);
|
||||
} else {
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
'SELECT * FROM ' . PhpMyAdmin\Util::backquote($table) . ' LIMIT 1;',
|
||||
null,
|
||||
PhpMyAdmin\DatabaseInterface::CONNECT_USER,
|
||||
PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$row = $GLOBALS['dbi']->fetchAssoc($result);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user