Using a PostgreSQL refcursor.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Good morning.

Is there a way to use a returned refcursor from PostgreSQL using PDO? I
have scoured the web and have yet to find a good result. Here's a few
things I've tried.

This example simply does not work.
-----
$database = Database::load(); // Returns a singleton object with PDO
connected to the database.
$sql = "select my_function();";
$p = $database->query($sql);
$p->execute();
$result = $p->fetchAll();
$p->closeCursor();
-----

This example is closer but PDO complains that the cursor is already
open.
-----
$database = Database::load(); // Returns a singleton object with PDO
connected to the database.
$sql = "BEGIN; select my_function('my_refcursor'); FETCH ALL from
'my_refcursor';";
$p = $database->query($sql);
$p->execute();
$result = $p->fetchAll();
$p->closeCursor();
-----



Matthew Hartman
Programmer/Analyst
Information Management, ICP
Kingston General Hospital
(613) 549-6666 x4294 
 
.now.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux