ID:               44135
 Updated by:       [EMAIL PROTECTED]
 Reported By:      chx1975 at gmail dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         PDO related
 Operating System: Linux
 PHP Version:      5.2.5
-Assigned To:      
+Assigned To:      johannes


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

[2008-10-23 01:34:27] chx1975 at gmail dot com

An attempt to fix this can be found at
http://drupal4hu.com/php-44135.patch . I added a number of flags not
just the one I needed.

running 
<?php
$p = new PDO('mysql:host=localhost;dbname=test', 'root', '',
array(PDO::MYSQL_ATTR_CLIENT_FLAGS => PDO::MYSQL_CLIENT_FOUND_ROWS));
$p->exec('TRUNCATE a');
$p->exec('INSERT INTO a VALUES (1)');
echo $p->exec('UPDATE a SET a = 1 WHERE a = 1');
$p = new PDO('mysql:host=localhost;dbname=test', 'root', '');
echo $p->exec('UPDATE a SET a = 1 WHERE a = 1');
?>
shows a 1 (one row found) and then a 0 (0 updated) so the patch seems
to work.

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

[2008-02-16 03:29:44] larry at garfieldtech dot com

I can duplicate this problem.  The issue appears to be that by 
default, MySQL will return the number of affected rows from a 
previous UPDATE statement, not the number of matched rows.  That 
values will differ if the update statement would set a row to its 
existing value.  With ext/mysql and ext/mysqli, it can be set to 
return matched rows instead.  PDO does not appear to have a way to 
allow that.

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

[2008-02-16 03:26:34] chx1975 at gmail dot com

Description:
------------
mysql_real_connect supports client flags
http://dev.mysql.com/doc/refman/4.1/en/mysql-real-connect.html most
importantly CLIENT_FOUND_ROWS but PDO provides no way to pass it in.



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


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

Reply via email to