php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46007 PDO_Sqlite: PDOStatement::rowCount() and PDO::exec() always returns 0
Submitted: 2008-09-06 05:45 UTC Modified: 2009-01-28 02:58 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: aragon at phat dot za dot net Assigned:
Status: Closed Package: PDO related
PHP Version: 5.2.6 OS: FreeBSD 7.0-STABLE
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: aragon at phat dot za dot net
New email:
PHP Version: OS:

 

 [2008-09-06 05:45 UTC] aragon at phat dot za dot net
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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-28 22:09 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2008-11-04 20:27 UTC] aragon at phat dot za dot net
Just tried the latest snapshot.  It appears to be fixed.  Thanks a million!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 12:01:36 2025 UTC