Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005388 [Quercus] minor always 03-06-13 05:00 03-06-13 05:36
Reporter konst View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 4.0.36
Summary 0005388: PDOStatement.rowCount() doesn't meet DELETE, INSERT, or UPDATE statements specification
Description According to the specification of PDOStatement.rowCount() from, [^]
it must return "the number of rows affected by the last DELETE, INSERT, or UPDATE statement".
"... SELECT statement, some databases may return the number of rows returned by that statement. However, this behaviour is not guaranteed"
However the current implementation of rowCount() was only returning the number of rows returned by SELECT statement.
By this commit the implementation has changed to return the number of rows affected by DELETE, INSERT, or UPDATE statements and also the number of rows returned by the SELECT statement

File: modules\quercus\src\com\caucho\quercus\lib\db\
Additional Information Going to commit the fix to the following repository: [^]
or [^]
Attached Files

- Relationships

- Notes
03-06-13 05:07
edited on: 03-06-13 05:08


$sql = "UPDATE `character` SET `xp` = `xp` + 5 WHERE `xp` = 0 AND `character_id` = :id";

$st = PDO::prepare($sql);

$st->bindValue(':id', $id);
$affectedRowsCount = $st->rowCount();

// Because of this issue, the $affectedRowsCount is always == 0
if ($affectedRowsCount == 0)
  echo "No characters found who need XP";

03-06-13 05:36

Submitted a fix into file
File: modules\quercus\src\com\caucho\quercus\lib\db\
at repository: [^]

- Issue History
Date Modified Username Field Change
03-06-13 05:00 konst New Issue
03-06-13 05:07 konst Note Added: 0006207
03-06-13 05:08 konst Note Edited: 0006207
03-06-13 05:36 konst Note Added: 0006208

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker