From:             sigurd at totallydigital dot co dot nz
Operating system: Debian Linux
PHP version:      4.3.8
PHP Bug Type:     MySQL related
Bug description:  mysql_pconnect silently ignores the CLIENT_FOUND_ROWS flag

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 bug report at http://bugs.php.net/?id=29763&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29763&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29763&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29763&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29763&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29763&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29763&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29763&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29763&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29763&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29763&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29763&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29763&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29763&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29763&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29763&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29763&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29763&r=float

Reply via email to