RE: [PHP-WIN] [PHP-DB] mssql_next_result and stored procedures

From: Date: Tue, 10 Dec 2002 14:48:01 +0000
Subject: RE: [PHP-WIN] [PHP-DB] mssql_next_result and stored procedures
Groups: php.windows 
Request: Send a blank email to php-windows+get-17375@lists.php.net to get a copy of this message
Looks like a workable work-around. Thank you! RE: ODBC. I did not try it. I suspect that native API, however limited, should be more robust compared to generic ODBC approach. best regards gd -----Original Message----- From: Svensson, B.A.T. (HKG) [mailto:B.A.T.Svensson@lumc.nl] Sent: Tuesday, December 10, 2002 6:52 AM To: Gene Dymarskiy; php-windows@lists.php.net Subject: RE: [PHP-WIN] [PHP-DB] mssql_next_result and stored procedures > It appears that mssql_next_result does not work with stored procedures. > > I was able to use the function with PHP side queries. > However when a stored proc returns multiple result sets I am able > to grab only first set and get the following warning: > > Warning: mssql_execute: multiple recordsets from a stored procedure > not supported yet! (Skipping...) > > I run PHP 4.2.0 > > Is there a work around for this limitation? Put everything in a temporary table and return only that one. Normally I only return data in one format (that is a one column table wit a varchar typically 2000 byte or so.) But if you need to return row types in each result set, then you need to specify a protocol to handle this. This is several Q&D way to handle it: 1) Join all result sets to a concatenated table; plus an additional column (flag) that specify which "result set a particularly tupple belongs to. For example if you wish to return table A(a1, a2) and table B(b1, b2) create table AB(flag,a1,a2,b1,b2) And return typically: 1 data data null null 1 data data null null 1 data data null null 2 null null data data 2 null null data data 2 null null data data 2 null null data data 2) Same as 1) except instead skipp the flag but read data until you encounter a null value, then you know you deal with a new result set (this requires that you return the result sets in a predetermined order. In case your insert order is of importance you will also need to add an auto incremental filed and sort by this one when returning the result set. > Perhaps it was solved in the later releases of PHP? ODBC should support multiple result set. My Ignorant remark: Does it work by using an ODBC connection with PHP?

« previous php.windows (#17375) next »