ID:               29763
 Updated by:       [EMAIL PROTECTED]
 Reported By:      sigurd at totallydigital dot co dot nz
-Status:           Open
+Status:           Bogus
 Bug Type:         MySQL related
 Operating System: Debian Linux
 PHP Version:      4.3.8
 New Comment:

Why would it tell you it changed something when it doesn't?
If you update a field with same data as it was before -> there is no
_change_ or affected rows.

Try the same with the mysql console.



Previous Comments:
------------------------------------------------------------------------

[2004-08-19 19:46:45] sigurd at totallydigital dot co dot nz

Description:
------------
PHP 4.3.8-5 installed as 'unstable' package from Debian recently.

Background: 

The CLIENT_FOUND_ROWS MySQL connection flag is a vital means for
verifying that an UPDATE has affected a row (without doing an
inefficient 'select' afterwards to doublecheck!)

Under 'normal' connection, however, an UPDATE that "updates" values to
what they are in the database already will not increment the
affected-row-count, hence the purpose of the CLIENT_FOUND_ROWS flag,
which when set, DOES return rows that matched the WHERE clause of the
UPDATE.

Bug:

When connecting to a server with 

$connectionid = mysql_pconnect($serveraddress, $username, $password,
2);

The CLIENT_FOUND_ROWS behaviour is not experienced.

Merely changing this to a standard connect, does work. (note the
addition of a fourth parameter!) E.g.;

$connectionid = mysql_pconnect($serveraddress, $username, $password,
false, 2);

Reproduce code:
---------------
$connectionid = mysql_pconnect($serveraddress, $username, $password,
2);

// aasume Field was not 1 to begin with;
mysql_query("UPDATE Field=1 WHERE SomeField=1");
print mysql_affected_rows(); // 1

mysql_query("UPDATE Field=1 WHERE SomeField=1");
print mysql_affected_rows(); // 0

// again for good measure.
mysql_query("UPDATE Field=5 WHERE SomeField=1");
print mysql_affected_rows(); // 1

Expected result:
----------------
Each update shold produce an affected row count of one.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29763&edit=1

Reply via email to