|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-08-28 20:24 UTC] sniper@php.net
[2004-08-28 22:54 UTC] sigurd at totallydigital dot co dot nz
[2004-08-30 07:04 UTC] georg@php.net
[2004-08-30 07:36 UTC] sigurd at totallydigital dot co dot nz
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 21:00:01 2025 UTC |
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.