diff --git a/ChangeLog b/ChangeLog index 4ea1a121c..b68237c79 100755 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ $Source$ * all concerned scripts: PMA_DBI_num_rows() * all concerned scripts: PMA_DBI_free_result() * all concerned scripts: PMA_DBI_insert_id() + * all concerned scripts: PMA_DBI_affected_rows() 2004-01-19 Marc Delisle * libraries/common.lib.php, libraries/dbi/mysql.dbi.lib.php: diff --git a/libraries/dbi/mysql.dbi.lib.php b/libraries/dbi/mysql.dbi.lib.php index fb3ee8c46..bfdfb6914 100644 --- a/libraries/dbi/mysql.dbi.lib.php +++ b/libraries/dbi/mysql.dbi.lib.php @@ -213,4 +213,15 @@ function PMA_DBI_insert_id($link) { return mysql_insert_id($link); } +function PMA_DBI_affected_rows($link) { + if (empty($link)) { + if (isset($GLOBALS['userlink'])) { + $link = $GLOBALS['userlink']; + } else { + return FALSE; + } + } + return mysql_affected_rows($link); +} + ?> diff --git a/read_dump.php b/read_dump.php index 39497e510..86c290f7a 100644 --- a/read_dump.php +++ b/read_dump.php @@ -278,7 +278,7 @@ if ($sql_query != '') { } } else if ($cfg['VerboseMultiSubmit']) { $a_num_rows = (int)@PMA_DBI_num_rows($result); - $a_aff_rows = (int)@mysql_affected_rows(); + $a_aff_rows = (int)@PMA_DBI_affected_rows(); if ($a_num_rows > 0) { $a_rows = $a_num_rows; $a_switch = $strRows . ': '; diff --git a/server_privileges.php b/server_privileges.php index df9ab1162..2d4f92eac 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -596,7 +596,7 @@ if (!empty($adduser_submit) || !empty($change_copy)) { $local_query = 'SELECT "foo" FROM `user` WHERE `User` = "' . PMA_sqlAddslashes($username) . '" AND `Host` = "' . $hostname . '";'; $res = PMA_mysql_query($local_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), $local_query); unset($local_query); - if (mysql_affected_rows($userlink) == 1) { + if (PMA_DBI_affected_rows($userlink) == 1) { $message = sprintf($strUserAlreadyExists, '\'' . $username . '\'@\'' . $hostname . '\''); $adduser = 1; } else { @@ -1018,7 +1018,7 @@ if (empty($adduser) && empty($checkprivs)) { } echo '' . "\n"; $res = PMA_mysql_query('SELECT "foo" FROM `user` WHERE `User` = "' . PMA_sqlAddslashes($username) . '" AND `Host` = "' . $hostname . '";', $userlink); - if (mysql_affected_rows($userlink) <= 0) { + if (PMA_DBI_affected_rows($userlink) <= 0) { echo $strUserNotFound; require_once('./footer.inc.php'); } @@ -1057,7 +1057,7 @@ if (empty($adduser) && empty($checkprivs)) { $sql_query = 'SELECT `Table_name`, `Table_priv`, IF(`Column_priv` = "", 0, 1) AS "Column_priv" FROM `tables_priv` WHERE `Host` = "' . $hostname . '" AND `User` = "' . PMA_sqlAddslashes($username) . '" AND `Db` = "' . $dbname . '" ORDER BY `Table_name` ASC;'; } $res = PMA_mysql_query($sql_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), $sql_query); - if (mysql_affected_rows($userlink) == 0) { + if (PMA_DBI_affected_rows($userlink) == 0) { echo ' ' . "\n" . '
' . $strNone . '
' . "\n" . ' ' . "\n"; diff --git a/sql.php b/sql.php index 56da97084..416f37501 100644 --- a/sql.php +++ b/sql.php @@ -338,7 +338,7 @@ else { if (!$is_affected) { $num_rows = ($result) ? @PMA_DBI_num_rows($result) : 0; } else if (!isset($num_rows)) { - $num_rows = @mysql_affected_rows(); + $num_rows = @PMA_DBI_affected_rows(); } // Checks if the current database has changed diff --git a/tbl_replace.php b/tbl_replace.php index 885ece1ba..fe93eae97 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -215,8 +215,8 @@ foreach($query AS $query_index => $single_query) { PMA_mysqlDie($error, '', '', $err_url); } } else { - if (@mysql_affected_rows()) { - $total_affected_rows += @mysql_affected_rows(); + if (@PMA_DBI_affected_rows()) { + $total_affected_rows += @PMA_DBI_affected_rows(); } $insert_id = PMA_DBI_insert_id();