#46007 [Opn->Fbk]: PDO_Sqlite: PDOStatement::rowCount() and PDO::exec() always returns 0

From: Date: Tue, 28 Oct 2008 22:09:55 +0000
Subject: #46007 [Opn->Fbk]: PDO_Sqlite: PDOStatement::rowCount() and PDO::exec() always returns 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-130248@lists.php.net to get a copy of this message
ID: 46007 Updated by: jani@php.net Reported By: aragon at phat dot za dot net -Status: Open +Status: Feedback Bug Type: PDO related Operating System: FreeBSD 7.0-STABLE PHP Version: 5.2.6 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2008-09-06 05:45:07] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46007&edit=1

« previous php.bugs (#130248) next »