Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] 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 Platform
Status new   OS
Projection none   OS Version
ETA none Fixed in Version Product Version 4.0.36
  Product Build
Summary 0005388: PDOStatement.rowCount() doesn't meet DELETE, INSERT, or UPDATE statements specification
Description According to the specification of PDOStatement.rowCount() from http://php.net/manual/en/pdostatement.rowcount.php, [^]
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\PDOStatement.java
Steps To Reproduce
Additional Information Going to commit the fix to the following repository:
https://github.com/mdaniel/svn-caucho-com-resin [^]
or
https://github.com/konst-git/svn-caucho-com-resin [^]
Attached Files

- Relationships

- Notes
(0006207)
konst
03-06-13 05:07
edited on: 03-06-13 05:08

Example:

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

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

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

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

 
(0006208)
konst
03-06-13 05:36

Submitted a fix into file
File: modules\quercus\src\com\caucho\quercus\lib\db\PDOStatement.java
at repository:
https://github.com/konst-git/svn-caucho-com-resin [^]
 

- 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