Using a PostgreSQL refcursor.

From: Date: Wed, 17 Jun 2009 15:20:52 +0000
Subject: Using a PostgreSQL refcursor.
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-46241@lists.php.net to get a copy of this message
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.

« previous php.db (#46241) next »