php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48188 Cannot execute a scrollable cursor twice with PDO_PGSQL
Submitted: 2009-05-08 08:52 UTC Modified: 2009-05-12 22:19 UTC
From: mbeccati@php.net Assigned: mbeccati (profile)
Status: Closed Package: PDO related
PHP Version: 5.3CVS-2009-05-08 (CVS) OS: *
Private report: No CVE-ID: None
 [2009-05-08 08:52 UTC] mbeccati@php.net
Description:
------------
Scrollable cursor support for PDO_PGSQL was introduced in PHP 5.3 (see bug #44861). Some small issues need to be ironed out, e.g. I found out that it's impossible to execute a pdo statement using a cursor twice. The current code fails as the cursor is already existing.

Reproduce code:
---------------
$pdo = new PDO("pgsql:dbname=test", 'user', 'pass', array(
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
));

$res = $pdo->prepare("SELECT (?)::int AS x", array(
        PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL
));
try {
        var_dump($res->execute(array(1)));
        var_dump($res->execute(array(2)));
}  catch (Exception $e) {
        var_dump($e->getMessage());
}


Expected result:
----------------
bool(true)
bool(true)

Actual result:
--------------
bool(true)
string(94) "SQLSTATE[42P03]: Duplicate cursor: 7 ERROR:  cursor "pdo_crsr_000000000104fee8" already exists"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-12 22:19 UTC] mbeccati@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC