use PMA_DBI function

This commit is contained in:
Marc Delisle
2004-01-20 20:24:00 +00:00
parent b0cc4dbb23
commit f8d049ace5
22 changed files with 59 additions and 59 deletions

View File

@@ -160,7 +160,7 @@ if (PMA_MYSQL_INT_VERSION > 40003) {
$local_option_selected = TRUE;
}
}
mysql_free_result($result);
PMA_DBI_free_result($result);
}
?>

View File

@@ -785,10 +785,10 @@ echo "\n";
* Close MySql connections
*/
if (isset($dbh) && $dbh) {
@mysql_close($dbh);
@PMA_DBI_close($dbh);
}
if (isset($userlink) && $userlink) {
@mysql_close($userlink);
@PMA_DBI_close($userlink);
}

View File

@@ -590,7 +590,7 @@ function PMA_safe_db_list($only_db_check, $dbh, $dblist_cnt, $rs, $userlink, $cf
// Access to "mysql" db allowed and dblist still empty -> gets the
// usable db list
if (!$dblist_cnt
&& ($rs && @mysql_numrows($rs))) {
&& ($rs && @PMA_DBI_num_rows($rs))) {
$row = PMA_mysql_fetch_array($rs);
mysql_free_result($rs);
// Correction uva 19991215
@@ -609,7 +609,7 @@ function PMA_safe_db_list($only_db_check, $dbh, $dblist_cnt, $rs, $userlink, $cf
// lem9: User can be blank (anonymous user)
$local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Select_priv = \'Y\' AND (User = \'' . PMA_sqlAddslashes($cfg['Server']['user']) . '\' OR User = \'\')';
$rs = PMA_mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
if ($rs && @mysql_numrows($rs)) {
if ($rs && @PMA_DBI_num_rows($rs)) {
// Will use as associative array of the following 2 code
// lines:
// the 1st is the only line intact from before
@@ -669,7 +669,7 @@ function PMA_safe_db_list($only_db_check, $dbh, $dblist_cnt, $rs, $userlink, $cf
// 2. get allowed dbs from the "mysql.tables_priv" table
$local_query = 'SELECT DISTINCT Db FROM mysql.tables_priv WHERE Table_priv LIKE \'%Select%\' AND User = \'' . PMA_sqlAddslashes($cfg['Server']['user']) . '\'';
$rs = PMA_mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
if ($rs && @mysql_numrows($rs)) {
if ($rs && @PMA_DBI_num_rows($rs)) {
while ($row = PMA_mysql_fetch_array($rs)) {
if (PMA_isInto($row['Db'], $dblist) == -1) {
$dblist[] = $row['Db'];

View File

@@ -25,7 +25,7 @@ if (!isset($is_table) || !$is_table) {
$is_table = @PMA_mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'');
}
if (empty($table)
|| !($is_table && @mysql_numrows($is_table))) {
|| !($is_table && @PMA_DBI_num_rows($is_table))) {
if (!isset($is_transformation_wrapper)) {
header('Location: ' . $cfg['PmaAbsoluteUri'] . 'db_details.php?' . PMA_generate_common_url($db, '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
}

View File

@@ -330,7 +330,7 @@ foreach($array_sh_page AS $key => $temp_sh_page) {
echo "<br>".htmlspecialchars($row['Field'])."\n";
}
echo '</div>' . "\n";
mysql_free_result($fields_rs);
PMA_DBI_free_result($fields_rs);
$i++;
}

View File

@@ -1283,7 +1283,7 @@ function PMA_RT_DOC($alltables ){
$check_time = (isset($showtable['Check_time']) ? PMA_localisedDate(strtotime($showtable['Check_time'])) : '');
if ($result) {
mysql_free_result($result);
PMA_DBI_free_result($result);
}
@@ -1326,7 +1326,7 @@ function PMA_RT_DOC($alltables ){
} // end while
if ($result) {
mysql_free_result($result);
PMA_DBI_free_result($result);
}
@@ -1498,7 +1498,7 @@ function PMA_RT_DOC($alltables ){
} */
} // end while
$pdf->SetFont('', '',14);
mysql_free_result($result);
PMA_DBI_free_result($result);
}//end each

View File

@@ -115,10 +115,10 @@ document.writeln('<a href="<?php echo $href; ?>" <?php echo $target . ' ' . $onc
* Close MySql connections
*/
if (isset($dbh) && $dbh) {
@mysql_close($dbh);
@PMA_DBI_close($dbh);
}
if (isset($userlink) && $userlink) {
@mysql_close($userlink);
@PMA_DBI_close($userlink);
}

View File

@@ -77,7 +77,7 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE)
$res = PMA_mysql_query($sql_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), $sql_query);
unset($sql_query);
$row1 = PMA_mysql_fetch_array($res, MYSQL_ASSOC);
mysql_free_result($res);
PMA_DBI_free_result($res);
$av_grants = explode ('\',\'' , substr($row1['Type'], 5, strlen($row1['Type']) - 7));
unset($row1);
$users_grants = explode(',', $row['Table_priv']);
@@ -164,7 +164,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
if ($res) {
$row = PMA_mysql_fetch_array($res, MYSQL_ASSOC);
}
@mysql_free_result($res);
@PMA_DBI_free_result($res);
}
if (empty($row)) {
if ($table == '*') {
@@ -182,7 +182,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
$row[$row1[0]] = 'N';
}
}
mysql_free_result($res);
PMA_DBI_free_result($res);
} else {
$row = array('Table_priv' => '');
}
@@ -192,7 +192,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
$res = PMA_mysql_query($sql_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), $sql_query);
unset($sql_query);
$row1 = PMA_mysql_fetch_array($res, MYSQL_ASSOC);
mysql_free_result($res);
PMA_DBI_free_result($res);
$av_grants = explode ('\',\'' , substr($row1['Type'], strpos($row1['Type'], '(') + 2, strpos($row1['Type'], ')') - strpos($row1['Type'], '(') - 3));
unset($row1);
$users_grants = explode(',', $row['Table_priv']);
@@ -213,7 +213,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
'References' => FALSE
);
}
mysql_free_result($res);
PMA_DBI_free_result($res);
unset($res);
unset($row1);
}
@@ -227,7 +227,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent =
$columns[$row1[0]][$current] = TRUE;
}
}
mysql_free_result($res);
PMA_DBI_free_result($res);
unset($res);
unset($row1);
unset($current);
@@ -489,7 +489,7 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0)
. $spaces . ' <select name="pred_hostname" id="select_pred_hostname" title="' . $GLOBALS['strHost'] . '"' . "\n";
$res = PMA_mysql_query('SELECT USER();', $userlink);
$row = @PMA_mysql_fetch_row($res);
@mysql_free_result($res);
@PMA_DBI_free_result($res);
unset($res);
if (!empty($row[0])) {
$thishost = str_replace("'", '', substr($row[0], (strrpos($row[0], '@') + 1)));
@@ -559,7 +559,7 @@ if (!empty($change_copy)) {
} else {
$row = PMA_mysql_fetch_array($res, MYSQL_ASSOC);
extract($row, EXTR_OVERWRITE);
mysql_free_result($res);
PMA_DBI_free_result($res);
$queries = array();
}
}
@@ -587,7 +587,7 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
case 'thishost':
$res = PMA_mysql_query('SELECT USER();', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SELECT USER();');
$row = PMA_mysql_fetch_row($res);
mysql_free_result($res);
PMA_DBI_free_result($res);
unset($res);
$hostname = substr($row[0], (strrpos($row[0], '@') + 1));
unset($row);
@@ -645,7 +645,7 @@ if (!empty($adduser_submit) || !empty($change_copy)) {
$queries[] = $sql_query;
}
unset($real_sql_query);
mysql_free_result($res);
PMA_DBI_free_result($res);
unset($res);
}
}
@@ -660,7 +660,7 @@ if (!empty($change_copy)) {
while ($row = PMA_mysql_fetch_array($res, MYSQL_ASSOC)) {
$queries[] = 'GRANT ' . join(', ', PMA_extractPrivInfo($row)) . ' ON `' . $row['Db'] . '`.* TO "' . PMA_sqlAddslashes($username) . '"@"' . $hostname . '"' . ($row['Grant_priv'] == 'Y' ? ' WITH GRANT OPTION' : '') . ';';
}
mysql_free_result($res);
PMA_DBI_free_result($res);
$local_query = 'SELECT `Db`, `Table_name`, `Table_priv` FROM `mysql`.`tables_priv` WHERE `User` = "' . PMA_sqlAddslashes($old_username) . '" AND `Host` = "' . $old_hostname . '";';
$res = PMA_mysql_query($local_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), $local_query);
while ($row = PMA_mysql_fetch_array($res, MYSQL_ASSOC)) {
@@ -819,7 +819,7 @@ if (!empty($delete) || (!empty($change_copy) && $mode < 4)) {
}
unset($this_table);
}
mysql_free_result($res);
PMA_DBI_free_result($res);
}
unset($res);
}
@@ -919,7 +919,7 @@ if (empty($adduser) && empty($checkprivs)) {
}
if (!$res) {
echo '<i>' . $strNoPrivileges . '</i>' . "\n";
@mysql_free_result($res);
@PMA_DBI_free_result($res);
unset($res);
} else {
if ($oldPrivTables) {
@@ -958,7 +958,7 @@ if (empty($adduser) && empty($checkprivs)) {
. ' </tr>' . "\n";
$useBgcolorOne = !$useBgcolorOne;
}
@mysql_free_result($res);
@PMA_DBI_free_result($res);
unset($res);
unset ($row);
echo ' <tr>' . "\n"
@@ -1022,7 +1022,7 @@ if (empty($adduser) && empty($checkprivs)) {
echo $strUserNotFound;
require_once('./footer.inc.php');
}
mysql_free_result($res);
PMA_DBI_free_result($res);
unset($res);
echo '<ul>' . "\n"
. ' <li>' . "\n"
@@ -1130,12 +1130,12 @@ if (empty($adduser) && empty($checkprivs)) {
$useBgcolorOne = !$useBgcolorOne;
} // end while
if (empty($dbname)) {
mysql_free_result($res2);
PMA_DBI_free_result($res2);
unset($res2);
unset($row2);
}
}
mysql_free_result($res);
PMA_DBI_free_result($res);
unset($res);
unset($row);
echo ' <tr>' . "\n"
@@ -1153,7 +1153,7 @@ if (empty($adduser) && empty($checkprivs)) {
$pred_db_array[] = $row[0];
}
}
mysql_free_result($res);
PMA_DBI_free_result($res);
unset($res);
unset($row);
if (!empty($pred_db_array)) {
@@ -1175,7 +1175,7 @@ if (empty($adduser) && empty($checkprivs)) {
$pred_tbl_array[] = $row[0];
}
}
mysql_free_result($res);
PMA_DBI_free_result($res);
unset($res);
unset($row);
if (!empty($pred_tbl_array)) {

View File

@@ -45,7 +45,7 @@ $res = @PMA_mysql_query($sql_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($
while ($row = PMA_mysql_fetch_array($res, MYSQL_ASSOC)) {
$serverProcesses[] = $row;
}
@mysql_free_result($res);
@PMA_DBI_free_result($res);
unset($res);
unset($row);

View File

@@ -28,7 +28,7 @@ if (!empty($innodbstatus)) {
echo '<pre>' . "\n"
. htmlspecialchars($row[0]) . "\n"
. '</pre>' . "\n";
mysql_free_result($res);
PMA_DBI_free_result($res);
require_once('./footer.inc.php');
}
@@ -56,7 +56,7 @@ $res = @PMA_mysql_query('SHOW STATUS;', $userlink) or PMA_mysqlDie(PMA_mysql_err
while ($row = PMA_mysql_fetch_row($res)) {
$serverStatus[$row[0]] = $row[1];
}
@mysql_free_result($res);
@PMA_DBI_free_result($res);
unset($res);
unset($row);
@@ -68,7 +68,7 @@ unset($row);
$res = @PMA_mysql_query('SELECT UNIX_TIMESTAMP() - ' . $serverStatus['Uptime'] . ';');
$row = PMA_mysql_fetch_row($res);
echo sprintf($strServerStatusUptime, PMA_timespanFormat($serverStatus['Uptime']), PMA_localisedDate($row[0])) . "\n";
mysql_free_result($res);
PMA_DBI_free_result($res);
unset($res);
unset($row);
//Get query statistics

View File

@@ -40,18 +40,18 @@ if (PMA_MYSQL_INT_VERSION >= 40003) {
while ($row = PMA_mysql_fetch_row($res)) {
$serverVars[$row[0]] = $row[1];
}
@mysql_free_result($res);
@PMA_DBI_free_result($res);
$res = @PMA_mysql_query('SHOW GLOBAL VARIABLES;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW GLOBAL VARIABLES;');
while ($row = PMA_mysql_fetch_row($res)) {
$serverVarsGlobal[$row[0]] = $row[1];
}
@mysql_free_result($res);
@PMA_DBI_free_result($res);
} else {
$res = @PMA_mysql_query('SHOW VARIABLES;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW VARIABLES;');
while ($row = PMA_mysql_fetch_row($res)) {
$serverVars[$row[0]] = $row[1];
}
@mysql_free_result($res);
@PMA_DBI_free_result($res);
}
unset($res);
unset($row);

View File

@@ -296,7 +296,7 @@ else {
$cnt_all_result = @PMA_mysql_query('SELECT COUNT(*) as count' . $parts[2]);
if ($cnt_all_result) {
$num_rows = PMA_mysql_result($cnt_all_result, 0, 'count');
mysql_free_result($cnt_all_result);
PMA_DBI_free_result($cnt_all_result);
} else {
$num_rows = 0;
}
@@ -349,7 +349,7 @@ else {
$db = $row['db'];
$reload = 1;
}
@mysql_free_result($res);
@PMA_DBI_free_result($res);
unset($res);
unset($row);
@@ -463,7 +463,7 @@ else {
} else {
$unlim_num_rows = PMA_mysql_result($cnt_all_result, 0, 'count');
}
mysql_free_result($cnt_all_result);
PMA_DBI_free_result($cnt_all_result);
} else {
if (mysql_error()) {
@@ -652,7 +652,7 @@ else {
}
PMA_displayTable($result, $disp_mode, $analyzed_sql);
mysql_free_result($result);
PMA_DBI_free_result($result);
if ($disp_mode[6] == '1' || $disp_mode[9] == '1') {
echo "\n";

View File

@@ -178,7 +178,7 @@ if ($abort == FALSE) {
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . " LIKE '$field'";
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$fields_meta[] = PMA_mysql_fetch_array($result);
mysql_free_result($result);
PMA_DBI_free_result($result);
}
$num_fields = count($fields_meta);

View File

@@ -44,7 +44,7 @@ if (!defined('PMA_IDX_INCLUDED')) {
header('Location: ' . $cfg['PmaAbsoluteUri'] . $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db, '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
exit;
} else if (isset($is_table)) {
mysql_free_result($is_table);
PMA_DBI_free_result($is_table);
}
// Displays headers (if needed)
@@ -104,7 +104,7 @@ for ($i = 0; $i < $idx_cnt; $i++) {
if (defined('PMA_IDX_INCLUDED')) {
unset($ret_keys);
} else if ($result) {
mysql_free_result($result);
PMA_DBI_free_result($result);
}
// Get fields and stores their name/type
@@ -131,7 +131,7 @@ while ($row = PMA_mysql_fetch_array($fields_rs)) {
} // end while
if ($fields_rs) {
mysql_free_result($fields_rs);
PMA_DBI_free_result($fields_rs);
}

View File

@@ -85,7 +85,7 @@ foreach($the_tables AS $key => $table) {
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
if ($result) {
mysql_free_result($result);
PMA_DBI_free_result($result);
}
@@ -128,7 +128,7 @@ foreach($the_tables AS $key => $table) {
} // end while
if ($result) {
mysql_free_result($result);
PMA_DBI_free_result($result);
}
@@ -286,7 +286,7 @@ foreach($the_tables AS $key => $table) {
</tr>
<?php
} // end while
mysql_free_result($result);
PMA_DBI_free_result($result);
echo "\n";
?>

View File

@@ -588,7 +588,7 @@ if ($action == 'tbl_create.php') {
} // end if
} // end while
} // end if
mysql_free_result($result);
PMA_DBI_free_result($result);
echo "\n";
?>

View File

@@ -84,7 +84,7 @@ $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '
for ($i = 0; $row = PMA_mysql_fetch_array($result); $i++) {
$columns[$i] = $row['Field'];
}
mysql_free_result($result);
PMA_DBI_free_result($result);
/**
@@ -400,7 +400,7 @@ if ($cfgRelation['relwork'] && $tbl_type != "INNODB") {
} // end while
} // end if $result
mysql_free_result($result);
PMA_DBI_free_result($result);
echo "\n";
?>
<li>

View File

@@ -59,7 +59,7 @@ while ($row = PMA_mysql_fetch_array($result)) {
$pk_array[$row['Column_name']] = 1;
}
} // end while
mysql_free_result($result);
PMA_DBI_free_result($result);
// 3. Get fields
$local_query = 'SHOW FULL FIELDS FROM ' . PMA_backquote($table);

View File

@@ -33,7 +33,7 @@ for ($i = 0; $i < $tmp_cnt; $i++) {
}
} // end for
unset($tmp1, $tmp);
mysql_free_result($table_info_result);
PMA_DBI_free_result($table_info_result);
/**

View File

@@ -43,7 +43,7 @@ if (isset($db) && isset($table) && $table != '' && $db != '') {
while ($row = PMA_mysql_fetch_array($result)) {
$fields_list[] = $row['Field'];
} // end while
mysql_free_result($result);
PMA_DBI_free_result($result);
}
}

View File

@@ -79,7 +79,7 @@ if (!isset($param) || $param[0] == '') {
}
$fields_type[] = $type;
} // end while
mysql_free_result($result);
PMA_DBI_free_result($result);
// <markus@noga.de>
// retrieve keys into foreign fields, if any

View File

@@ -121,9 +121,9 @@ if (!isset($resize)) {
* Close MySql non-persistent connections
*/
if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) {
@mysql_close($GLOBALS['dbh']);
@PMA_DBI_close($GLOBALS['dbh']);
}
if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
@mysql_close($GLOBALS['userlink']);
@PMA_DBI_close($GLOBALS['userlink']);
}
?>