ID:               44135
 Comment by:       kamazee at gmail dot com
 Reported By:      chx1975 at gmail dot com
 Status:           To be documented
 Bug Type:         PDO related
 Operating System: Linux
 PHP Version:      5.2.5
 Assigned To:      johannes
 New Comment:

This issue is still actual for stable releases _after_ the PHP 5.2.5
(tested 5.2.6 for Linux and 5.2.8 for Windows).
Hope, changes will appear in stable branch soon.


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

[2008-10-27 18:36:12] johan...@php.net

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

New attributes PDO::MYSQL_ATTR_FOUND_ROWS and 
PDO::MYSQL_ATTR_IGNORE_SPACE added which can be used while connecting:


$p = new PDO($dsn, $u, $p,
   array(PDO::MYSQL_ATTR_FOUND_ROWS => true, 
         PDO::MYSQL_ATTR_IGNORE_SPACE=> true));

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

[2008-10-23 19:55:24] chx1975 at gmail dot com

I renamed it to what MySQL calls it. Please just drop the defines then,
I copied them from mysql_com.h -- sorry, I am a n00b in doing this.
Please also drop any client flags you do not feel useful.

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

[2008-10-23 13:25:24] johan...@php.net

Thanks for the patch, a few comments/questions:

- Why are you renaming the connect_opts variable? Any particular
reason?

- You shouldn't use the numeric values, as they might change, but the
values provided by the client library, this also ensures that only flags
supported by the library are being used.

- I think the SSL flag won't work without specific SSL certs & stuff,
but I have to check that myself

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

[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.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/44135

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

Reply via email to