Changed some queries to use MYSQLI_STORE_RESULT.
phpMyAdmin now works with MYSQLI_USE_RESULT as default.
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -5,6 +5,17 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2004-04-10 Marcel Tschopp <marcel.tschopp@gmx.net>
|
||||
db_datadict.php, db_details_db_info.php, db_details_qbe.php,
|
||||
db_details_structure.php, db_printview.php, left.php, main.php,
|
||||
pdf_pages.php, read_dump.php, server_privileges.php, sql.php,
|
||||
tbl_change.php, tbl_indexes.php, tbl_properties_structure.php,
|
||||
tbl_relation.php, tbl_select.php, libraries/database_interface.lib.php,
|
||||
libraries/db_table_exists.lib.php, libraries/mysql_charsets.lib.php,
|
||||
libraries/relation.lib.php, libraries/dbi/mysqli.dbi.lib.php:
|
||||
Changed some queries to use MYSQLI_STORE_RESULT. phpMyAdmin now works
|
||||
with MYSQLI_USE_RESULT as default.
|
||||
|
||||
2004-04-07 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* tbl_select.php, lang/*: feature 788608: new features for Search:
|
||||
DISTINCT, IS NULL, IS NOT NULL, NOT LIKE, multiple select for ENUM,
|
||||
|
@@ -53,7 +53,7 @@ if ($cfgRelation['commwork']) {
|
||||
* Selects the database and gets tables names
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
$rowset = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';');
|
||||
$rowset = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
|
||||
$count = 0;
|
||||
while ($row = PMA_DBI_fetch_assoc($rowset)) {
|
||||
|
@@ -30,7 +30,7 @@ if ($cfg['SkipLockedTables'] == TRUE) {
|
||||
PMA_DBI_free_result($db_info_result);
|
||||
|
||||
if (isset($sot_cache)) {
|
||||
$db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';');
|
||||
$db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
|
||||
while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
|
||||
if (!isset($sot_cache[$tmp[0]])) {
|
||||
@@ -48,14 +48,14 @@ if ($cfg['SkipLockedTables'] == TRUE) {
|
||||
}
|
||||
}
|
||||
if (!isset($sot_ready)) {
|
||||
$db_info_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
|
||||
$db_info_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
|
||||
while ($sts_tmp = PMA_DBI_fetch_assoc($db_info_result)) {
|
||||
$tables[] = $sts_tmp;
|
||||
}
|
||||
PMA_DBI_free_result($db_info_result);
|
||||
unset($db_info_result);
|
||||
}
|
||||
@PMA_DBI_free_result($db_info_result);
|
||||
unset($db_info_result);
|
||||
}
|
||||
$num_tables = (isset($tables) ? count($tables) : 0);
|
||||
|
||||
|
@@ -114,7 +114,7 @@ if ($row < 0) {
|
||||
/**
|
||||
* Prepares the form
|
||||
*/
|
||||
$tbl_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';');
|
||||
$tbl_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
$tbl_result_cnt = PMA_DBI_num_rows($tbl_result);
|
||||
$i = 0;
|
||||
$k = 0;
|
||||
|
@@ -76,7 +76,6 @@ if (isset($db) && isset($db_rename) && $db_rename == 'true') {
|
||||
$db = $newname;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the tables list if the user where not redirected to this script
|
||||
* because there is no table in the database ($is_info is TRUE)
|
||||
@@ -243,6 +242,8 @@ else {
|
||||
}
|
||||
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
unset($result);
|
||||
} // end if
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
|
@@ -45,7 +45,7 @@ if ($cfg['SkipLockedTables'] == TRUE) {
|
||||
unset($result);
|
||||
|
||||
if (isset($sot_cache)) {
|
||||
$result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';');
|
||||
$result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
|
||||
while ($tmp = PMA_DBI_fetch_row($result)) {
|
||||
if (!isset($sot_cache[$tmp[0]])) {
|
||||
|
4
left.php
4
left.php
@@ -417,7 +417,7 @@ if ($num_dbs > 1) {
|
||||
if (!empty($db_start) && $db == $db_start) {
|
||||
$selected_db = $j;
|
||||
}
|
||||
$tables = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';');
|
||||
$tables = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
$num_tables = ($tables) ? @PMA_DBI_num_rows($tables) : 0;
|
||||
$common_url_query = PMA_generate_common_url($db);
|
||||
if ($num_tables) {
|
||||
@@ -641,7 +641,7 @@ if ($num_dbs > 1) {
|
||||
// Case where only one database has to be displayed
|
||||
else if ($num_dbs == 1) {
|
||||
$db = $dblist[0];
|
||||
$tables = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';');
|
||||
$tables = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
$num_tables = ($tables) ? @PMA_DBI_num_rows($tables) : 0;
|
||||
$common_url_query = PMA_generate_common_url($db);
|
||||
if ($num_tables) {
|
||||
|
@@ -52,7 +52,7 @@ function PMA_DBI_get_dblist($link = NULL) {
|
||||
}
|
||||
|
||||
function PMA_DBI_get_tables($database, $link = NULL) {
|
||||
$result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($database) . ';');
|
||||
$result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($database) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
$tables = array();
|
||||
while (list($current) = PMA_DBI_fetch_row($result)) {
|
||||
$tables[] = $current;
|
||||
|
@@ -22,7 +22,7 @@ if (!isset($is_db) || !$is_db) {
|
||||
if (!isset($is_table) || !$is_table) {
|
||||
// Not a valid table name -> back to the db_details.php
|
||||
if (!empty($table)) {
|
||||
$is_table = PMA_DBI_try_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';');
|
||||
$is_table = PMA_DBI_try_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE);
|
||||
}
|
||||
if (empty($table)
|
||||
|| !($is_table && @PMA_DBI_num_rows($is_table))) {
|
||||
|
@@ -97,7 +97,7 @@ function PMA_DBI_try_query($query, $link = NULL, $options = 0) {
|
||||
} elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) {
|
||||
$method = MYSQLI_USE_RESULT;
|
||||
} else {
|
||||
$method = MYSQLI_STORE_RESULT;
|
||||
$method = MYSQLI_USE_RESULT;
|
||||
}
|
||||
|
||||
if (empty($link)) {
|
||||
|
@@ -226,11 +226,9 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
|
||||
|
||||
function PMA_getDbCollation($db) {
|
||||
global $userlink;
|
||||
|
||||
if (PMA_MYSQL_INT_VERSION >= 40101) {
|
||||
// MySQL 4.1.0 does not support seperate charset settings
|
||||
// for databases.
|
||||
|
||||
$res = PMA_DBI_query('SHOW CREATE DATABASE ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
$row = PMA_DBI_fetch_row($res);
|
||||
PMA_DBI_free_result($res);
|
||||
|
@@ -104,7 +104,7 @@ function PMA_getRelationsParam($verbose = FALSE)
|
||||
// PMA_DBI_select_db($cfgRelation['db']);
|
||||
|
||||
$tab_query = 'SHOW TABLES FROM ' . PMA_backquote($cfgRelation['db']);
|
||||
$tab_rs = PMA_query_as_cu($tab_query, FALSE);
|
||||
$tab_rs = PMA_query_as_cu($tab_query, NULL, PMA_DBI_QUERY_STORE);
|
||||
|
||||
while ($curr_table = @PMA_DBI_fetch_row($tab_rs)) {
|
||||
if ($curr_table[0] == $cfg['Server']['bookmarktable']) {
|
||||
|
8
main.php
8
main.php
@@ -180,7 +180,7 @@ if ($server > 0) {
|
||||
// We were checking privileges with 'USE mysql' but users with the global
|
||||
// priv CREATE TEMPORARY TABLES or LOCK TABLES can do a 'USE mysql'
|
||||
// (even if they cannot see the tables)
|
||||
$is_superuser = PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', $userlink);
|
||||
$is_superuser = PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', $userlink, PMA_DBI_QUERY_STORE);
|
||||
if ($dbh) {
|
||||
$local_query = 'SELECT Create_priv, Reload_priv FROM mysql.user WHERE User = \'' . PMA_sqlAddslashes($mysql_cur_user) . '\'';
|
||||
$rs_usr = PMA_DBI_try_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
|
||||
@@ -201,7 +201,7 @@ if ($server > 0) {
|
||||
// the first inexistant db name that we find, in most cases it's probably
|
||||
// the one he just dropped :)
|
||||
if (!$is_create_priv) {
|
||||
$rs_usr = PMA_DBI_try_query('SELECT DISTINCT Db FROM mysql.db WHERE Create_priv = \'Y\' AND User = \'' . PMA_sqlAddslashes($mysql_cur_user) . '\';', $dbh);
|
||||
$rs_usr = PMA_DBI_try_query('SELECT DISTINCT Db FROM mysql.db WHERE Create_priv = \'Y\' AND User = \'' . PMA_sqlAddslashes($mysql_cur_user) . '\';', $dbh, PMA_DBI_QUERY_STORE);
|
||||
if ($rs_usr) {
|
||||
$re0 = '(^|(\\\\\\\\)+|[^\])'; // non-escaped wildcards
|
||||
$re1 = '(^|[^\])(\\\)+'; // escaped wildcards
|
||||
@@ -221,11 +221,11 @@ if ($server > 0) {
|
||||
// Finally, let's try to get the user's privileges by using SHOW
|
||||
// GRANTS...
|
||||
// Maybe we'll find a little CREATE priv there :)
|
||||
$rs_usr = PMA_DBI_try_query('SHOW GRANTS FOR ' . $mysql_cur_user_and_host . ';', $dbh);
|
||||
$rs_usr = PMA_DBI_try_query('SHOW GRANTS FOR ' . $mysql_cur_user_and_host . ';', $dbh, PMA_DBI_QUERY_STORE);
|
||||
if (!$rs_usr) {
|
||||
// OK, now we'd have to guess the user's hostname, but we
|
||||
// only try out the 'username'@'%' case.
|
||||
$rs_usr = PMA_DBI_try_query('SHOW GRANTS FOR ' . $mysql_cur_user . ';', $dbh);
|
||||
$rs_usr = PMA_DBI_try_query('SHOW GRANTS FOR ' . $mysql_cur_user . ';', $dbh, PMA_DBI_QUERY_STORE);
|
||||
}
|
||||
unset($local_query);
|
||||
if ($rs_usr) {
|
||||
|
@@ -221,7 +221,7 @@ if ($cfgRelation['pdfwork']) {
|
||||
|
||||
// We will need an array of all tables in this db
|
||||
$selectboxall = array('--');
|
||||
$alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';');
|
||||
$alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
|
||||
$selectboxall[] = $val[0];
|
||||
}
|
||||
|
@@ -346,7 +346,7 @@ if ($goto == 'tbl_properties.php') {
|
||||
$goto = 'db_details.php';
|
||||
} else {
|
||||
PMA_DBI_select_db($db);
|
||||
$is_table = PMA_DBI_try_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'');
|
||||
$is_table = PMA_DBI_try_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE);
|
||||
if (!($is_table && @PMA_DBI_num_rows($is_table))) {
|
||||
$goto = 'db_details.php';
|
||||
unset($table);
|
||||
|
@@ -1175,7 +1175,7 @@ if (empty($adduser) && empty($checkprivs)) {
|
||||
} else {
|
||||
echo ' <input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '"/>' . "\n"
|
||||
. ' <label for="text_tablename">' . $strAddPrivilegesOnTbl . ':</label>' . "\n";
|
||||
if ($res = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($dbname) . ';')) {
|
||||
if ($res = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($dbname) . ';', NULL, PMA_DBI_QUERY_STORE)) {
|
||||
$pred_tbl_array = array();
|
||||
while ($row = PMA_DBI_fetch_row($res)) {
|
||||
if (!isset($found_rows) || !in_array($row[0], $found_rows)) {
|
||||
|
4
sql.php
4
sql.php
@@ -319,7 +319,7 @@ else {
|
||||
list($usec, $sec) = explode(' ',microtime());
|
||||
$querytime_before = ((float)$usec + (float)$sec);
|
||||
|
||||
$result = @PMA_DBI_try_query($full_sql_query);
|
||||
$result = @PMA_DBI_try_query($full_sql_query, NULL, true);
|
||||
|
||||
list($usec, $sec) = explode(' ',microtime());
|
||||
$querytime_after = ((float)$usec + (float)$sec);
|
||||
@@ -563,7 +563,7 @@ else {
|
||||
if (!isset($table)) {
|
||||
$goto = 'db_details.php';
|
||||
} else {
|
||||
$is_table = @PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';');
|
||||
$is_table = @PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE);
|
||||
if (!($is_table && @PMA_DBI_num_rows($is_table))) {
|
||||
$goto = 'db_details.php';
|
||||
unset($table);
|
||||
|
@@ -74,12 +74,11 @@ $url_query = PMA_generate_common_url($db, $table)
|
||||
require('./tbl_properties_table_info.php');
|
||||
echo '<br />';
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of the fields of the current table
|
||||
*/
|
||||
PMA_DBI_select_db($db);
|
||||
$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';');
|
||||
$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
if (isset($primary_key)) {
|
||||
if (is_array($primary_key)) {
|
||||
$primary_key_array = $primary_key;
|
||||
@@ -91,8 +90,9 @@ if (isset($primary_key)) {
|
||||
$result = array();
|
||||
foreach($primary_key_array AS $rowcount => $primary_key) {
|
||||
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';';
|
||||
$result[$rowcount] = PMA_DBI_query($local_query);
|
||||
$result[$rowcount] = PMA_DBI_query($local_query, NULL, PMA_DBI_QUERY_STORE);
|
||||
$row[$rowcount] = PMA_DBI_fetch_assoc($result[$rowcount]);
|
||||
//PMA_DBI_free_result($result[$rowcount]);
|
||||
$primary_keys[$rowcount] = $primary_key;
|
||||
|
||||
// No row returned
|
||||
|
@@ -37,7 +37,7 @@ if (!defined('PMA_IDX_INCLUDED')) {
|
||||
}
|
||||
// Not a valid table name -> back to the default db_details sub-page
|
||||
if (!empty($table)) {
|
||||
$is_table = PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'');
|
||||
$is_table = PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE);
|
||||
}
|
||||
if (empty($table)
|
||||
|| !($is_table && PMA_DBI_num_rows($is_table))) {
|
||||
|
@@ -34,7 +34,7 @@ $url_query .= '&goto=tbl_properties_structure.php&back=tbl_properties_st
|
||||
/**
|
||||
* Prepares the table structure display
|
||||
*/
|
||||
// 1. Get table information/display tabs
|
||||
// 1. Get table information/display tabs;
|
||||
require('./tbl_properties_table_info.php');
|
||||
|
||||
/**
|
||||
|
@@ -269,7 +269,7 @@ if ($cfgRelation['relwork']) {
|
||||
}
|
||||
// [0] of the row is the name
|
||||
|
||||
$tab_rs = PMA_DBI_query($tab_query);
|
||||
$tab_rs = PMA_DBI_query($tab_query, NULL, PMA_DBI_QUERY_STORE);
|
||||
$selectboxall['nix'] = '--';
|
||||
$selectboxall_innodb['nix'] = '--';
|
||||
|
||||
|
@@ -61,7 +61,7 @@ if (!isset($param) || $param[0] == '') {
|
||||
$err_url = $goto . '?' . PMA_generate_common_url($db, $table);
|
||||
|
||||
// Gets the list and number of fields
|
||||
$result = PMA_DBI_query('SHOW' . (PMA_MYSQL_INT_VERSION >= 40100 ? ' FULL' : '') . ' FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';');
|
||||
$result = PMA_DBI_query('SHOW' . (PMA_MYSQL_INT_VERSION >= 40100 ? ' FULL' : '') . ' FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
$fields_cnt = PMA_DBI_num_rows($result);
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
$fields_list[] = $row['Field'];
|
||||
|
Reference in New Issue
Block a user