#39612 [Opn->Bgs]: closeCursor() does not allow SQLite 2 statement to resume
ID: 39612
Updated by: tony2001@php.net
Reported By: randy at rcs-comp dot com
-Status: Open
+Status: Bogus
Bug Type: PDO related
Operating System: Windows XP
PHP Version: 5.2.0
New Comment:
>leaves the statement in a state that enables it to be
>executed again.
"executed again", not "fetched again".
SQLite3 supports sqlite3_reset() method which resets the statement and
for some reason it's still possible to fetch the results without
re-executing the statement (I think it's wrong, though).
SQLite2 does not have such a method, so closeCursor() just fetches all
the data from the statement and "leaves the statement in a state that
enables it to be executed again".
Yes, you have to re-execute it again.
Previous Comments:
------------------------------------------------------------------------
[2006-11-24 07:39:19] randy at rcs-comp dot com
Description:
------------
The documentation for PDOStatement::closeCursor():
frees up the connection to the server so that other SQL statements may
be issued, but leaves the statement in a state that enables it to be
executed again.
When using PDO with a SQLite 3 connection, this works as intended.
However, when trying to resume with a SQLite 2 connection, fetch()
returns FALSE.
Reproduce code:
---------------
http://www.rcs-comp.com/phpcode/simple_pdo_test2.php.txt
Expected result:
----------------
4 arrays of the first row of data:
>php simple_pdo_test2.php
Array
(
[id] => 1
[0] => 1
[user] => user1
[1] => user1
[email] => user1@example.com
[2] => user1@example.com
[time] => 1164353530
[3] => 1164353530
[message] => this is my message 1
[4] => this is my message 1
[confirmed] => 0
[5] => 0
)
Array
(
[id] => 1
[0] => 1
[user] => user1
[1] => user1
[email] => user1@example.com
[2] => user1@example.com
[time] => 1164353530
[3] => 1164353530
[message] => this is my message 1
[4] => this is my message 1
[confirmed] => 0
[5] => 0
)
Array
(
[id] => 1
[0] => 1
[user] => user1
[1] => user1
[email] => user1@example.com
[2] => user1@example.com
[time] => 1164353530
[3] => 1164353530
[message] => this is my message 1
[4] => this is my message 1
[confirmed] => 0
[5] => 0
)
Array
(
[id] => 1
[0] => 1
[user] => user1
[1] => user1
[email] => user1@example.com
[2] => user1@example.com
[time] => 1164353530
[3] => 1164353530
[message] => this is my message 1
[4] => this is my message 1
[confirmed] => 0
[5] => 0
)
Actual result:
--------------
The last call to fetch() returns FALSE
>php simple_pdo_test2.php
Array
(
[id] => 1
[0] => 1
[user] => user1
[1] => user1
[email] => user1@example.com
[2] => user1@example.com
[time] => 1164353530
[3] => 1164353530
[message] => this is my message 1
[4] => this is my message 1
[confirmed] => 0
[5] => 0
)
Array
(
[id] => 1
[0] => 1
[user] => user1
[1] => user1
[email] => user1@example.com
[2] => user1@example.com
[time] => 1164353530
[3] => 1164353530
[message] => this is my message 1
[4] => this is my message 1
[confirmed] => 0
[5] => 0
)
Array
(
[id] => 1
[0] => 1
[user] => user1
[1] => user1
[email] => user1@example.com
[2] => user1@example.com
[time] => 1164353530
[3] => 1164353530
[message] => this is my message 1
[4] => this is my message 1
[confirmed] => 0
[5] => 0
)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39612&edit=1
Thread (2 messages)