php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39310 PDO Scrolling cursors not available for Sqlite and don't work for Mysql
Submitted: 2006-10-30 16:21 UTC Modified: 2006-12-08 15:54 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: randy at rcs-comp dot com Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.1.6 OS: Win XP
Private report: No CVE-ID: None
 [2006-10-30 16:21 UTC] randy at rcs-comp dot com
Description:
------------
When trying to make the scrolling cursor example found here:

http://us2.php.net/manual/en/function.pdostatement-fetch.php

under Example 2 to work, I could not.  Note that I am unsure of which way I should use the prepare statement.  The example uses this:

$stmt = $dbh->prepare($sql, array(PDO::ATTR_CURSOR, PDO::CURSOR_SCROLL));

But based on the documentation here:

http://us2.php.net/manual/en/function.pdo-prepare.php

It seems that this would make more sense (the driver options are in an associative array:

$stmt = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));

Note that I have tried both methods for both Sqlite and MySQL.  The results are as follows:

MySql w/ example array: returns object but scrolling does not work.
MySql w/ associative array: returns object but scrolling does not work.
SQLite w/ example array: returns object but scrolling does not work.
SQLite w/ associative array: returns FALSE


Reproduce code:
---------------
Example file can be found here:

http://www.rcs-comp.com/tmp/simple_pdo_test.php

>php simple_pdo_test.php


Expected result:
----------------
connections created
tables created: 0 0
tables filled
user3   user3@example.com       1162224979
user2   user2@example.com       1162224979
user1   user1@example.com       1162224979
object(PDOStatement)#3 (1) {
  ["queryString"]=>
  string(53) "SELECT user, email, time FROM testtable ORDER BY user"
}
user3   user3@example.com       1162224979
user2   user2@example.com       1162224979
user1   user1@example.com       1162224979
user3   user3@example.com       1162224979
user2   user2@example.com       1162224979
user1   user1@example.com       1162224979
rows updated: 3 3
rows deleted: 3 3
tables droped: 3 0

Actual result:
--------------
connections created
tables created: 0 0
tables filled
user1   user1@example.com       1162224979
user2   user2@example.com       1162224979
user3   user3@example.com       1162224979
bool(false)
user1   user1@example.com       1162224979
user2   user2@example.com       1162224979
user3   user3@example.com       1162224979
user1   user1@example.com       1162224979
user2   user2@example.com       1162224979
user3   user3@example.com       1162224979
rows updated: 3 3
rows deleted: 3 3
tables droped: 3 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-30 16:23 UTC] randy at rcs-comp dot com
Sorry, reproduce code file is here:

http://www.rcs-comp.com/tmp/simple_pdo_test.php.txt
 [2006-11-16 22:39 UTC] randy at rcs-comp dot com
For what it is worth, I have confirmed that this continues to be a problem in version 5.2.0.
 [2006-12-04 02:30 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

This is because cursors are only supported in instance where 
the underlying database provides such functionality. In the 
case of MySQL and SQLite there is no such support. PDO does 
not provide emulation for cursors.
 [2006-12-08 15:54 UTC] randy at rcs-comp dot com
Is there anywhere in the documentation that describes what database drivers support this?  Or, is there a way to tell programatically?

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC