PMA_DBI_affected_rows

This commit is contained in:
Marc Delisle
2004-01-20 21:03:31 +00:00
parent a69eb2ebbc
commit a7bd761f3f
6 changed files with 19 additions and 7 deletions

View File

@@ -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 <lem9@users.sourceforge.net>
* libraries/common.lib.php, libraries/dbi/mysql.dbi.lib.php:

View File

@@ -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);
}
?>

View File

@@ -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 . ': ';

View File

@@ -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, '<i>\'' . $username . '\'@\'' . $hostname . '\'</i>');
$adduser = 1;
} else {
@@ -1018,7 +1018,7 @@ if (empty($adduser) && empty($checkprivs)) {
}
echo '</h2>' . "\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 ' <tr>' . "\n"
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '" colspan="6"><center><i>' . $strNone . '</i></center></td>' . "\n"
. ' </tr>' . "\n";

View File

@@ -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

View File

@@ -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();