From:             aragon at phat dot za dot net
Operating system: FreeBSD 7.0-STABLE
PHP version:      5.2.6
PHP Bug Type:     SQLite related
Bug description:  PDOStatement::rowCount() and PDO::exec() always returns 0

Description:
------------
When executing an UPDATE query to a SQLite3 database,
PDOStatement::rowCount() and PDO:exec() returns 0 instead of 1 or more when
rows are updated in the database.

Reproduce code:
---------------
$db = new PDO('sqlite:crnl.db');
// PDO::exec() example
$sql = 'SELECT tags FROM blog_entries WHERE docid = 1';
$statement = $db->query($sql);
$row = $statement->fetch();
echo $row[0], "\n";
$sql = 'UPDATE blog_entries SET tags = \'test\' WHERE docid = 1';
echo $db->exec($sql), "\n";
$sql = 'SELECT tags FROM blog_entries WHERE docid = 1';
$statement = $db->query($sql);
$row = $statement->fetch();
echo $row[0], "\n";
// PDO:rowCount() example
$sql = 'UPDATE blog_entries SET tags = \'untest\' WHERE docid = 1';
echo $db->query($sql)->rowCount(), "\n";
$sql = 'SELECT tags FROM blog_entries WHERE docid = 1';
$statement = $db->query($sql);
$row = $statement->fetch();
echo $row[0], "\n";

Expected result:
----------------
untest
1
test
1
untest


Actual result:
--------------
untest
0
test
0
untest


-- 
Edit bug report at http://bugs.php.net/?id=46007&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=46007&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=46007&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=46007&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=46007&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=46007&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=46007&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=46007&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=46007&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=46007&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=46007&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=46007&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=46007&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=46007&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=46007&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=46007&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=46007&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=46007&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=46007&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=46007&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=46007&r=mysqlcfg

Reply via email to