From: "Hartman, Matthew" on
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.