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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 07:01:32 2024 UTC