Re: multiple result sets from DB_common::execute()

From: Date: Mon, 26 Jul 2004 21:08:35 +0000
Subject: Re: multiple result sets from DB_common::execute()
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13856@lists.php.net to get a copy of this message
At 04:34 PM 07/26/04, Justin Patrin wrote: >On Sun, 25 Jul 2004 12:41:59 -0400, Al Partis <alpartis@thundernet.com> wrote: >> Is it possible to receive multiple result sets from a call to DB_common::execute()? >> >> I am calling a DB2 stored proc over ODBC that returns multiple result sets. Is this >> possible through PHP/PEAR:DB? Based on my reading of the documentation, this method returns a >> DB_result object and nothing indicates to me that this object is a container class that could >> contain multiple result sets. Am I reading this wrong? >> > >A DB_Result has fetching methods. Please look at the documentation or >a tutorial about how to loop through the result set: > >$db = DB::connect($dsn); >$result = $db->query('SELECT ...'); >while($record = $result->fetchRow()) { > //do something with $record >} Thanks Justin, but the problem I'm having is not in retrieving multiple rows from a single result set, but in accessing multiple result sets. I'm calling a stored procedure that returns multiple result sets from the single call. This behavior is supported in at least Sybase, MS SQL Server, and DB2 that I know of. My code would look something like this: $db = DB::connect($dsn); $args = array($client_nbr); $query = "call StoredProc001 (!)"; $pstmt = $db->prepare($query); $result = $db->execute($pstmt, $args); If StoredProc returns 3 result sets, how do I access each of them individually so I can retrieve their contents? ________________________________________________________ Alan Partis thundernet development group

« previous php.pear.general (#13856) next »