|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37399 Stored Procedure with more than one Resultset
Submitted: 2006-05-10 14:40 UTC Modified: 2009-05-05 01:00 UTC
Avg. Score:4.6 ± 0.5
Reproduced:5 of 6 (83.3%)
Same Version:3 (60.0%)
Same OS:1 (20.0%)
From: aranna at free dot fr Assigned: fmk (profile)
Status: No Feedback Package: Sybase-ct (ctlib) related
PHP Version: 5.1.4 OS: RHEL3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: aranna at free dot fr
New email:
PHP Version: OS:


 [2006-05-10 14:40 UTC] aranna at free dot fr
PHP is compiled with Sybase ct support (even if using freetds 0.64 or Sybase open client). When i excute a stored procedure with more than one result, it's impossible to retrieve them (only the firt).

Reproduce code:
Proc example :

create proc more_resultset as
        //My first select
	SELECT * FROM table 1
        //My second
        SELECT * FROM table 2

Expected result:
There is no way with sybase support to exploit more than one result set (like mssql_next_result or mysqli_next_result).

I have got the right result when using "isql" client or "tsql" client of Sybase or FreeTds on command line.

Actual result:
Having only the first select return


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-16 01:13 UTC] jplock at gmail dot com
This used to work for us using FreeTDS 0.63 on Solaris 9 with PHP 5.1.2, but after upgrading to PHP 5.1.4, we can not retrieve multiple result sets back using mssql_next_result(), it always returns false.
 [2006-05-16 02:54 UTC] jplock at gmail dot com

In between those differences, a dbcancel(mssql_ptr->link); was added on line 1237 of php_mssql.c. In my case, we're executing a stored procedure which returns five different result sets. One of those result sets calls another stored procedure, which is failing because we're passing in a null value (its suppose to be a real value from the first stored procedure call), and is generate a "query failed" error. Could that 2nd "query failed" error be terminating the link and all of the previous result sets?
 [2006-05-16 03:00 UTC] jplock at gmail dot com
Ok, more testing, after reverting to PHP 5.1.2 version of ext/mssql (still using PHP 5.1.4), our stored procedure calls work properly again. Something with those dbcancel() calls messes up mssql_next_result(), unfortunately.
 [2006-05-16 06:29 UTC]
Assigned to the maintainer.
 [2006-05-16 09:15 UTC] aranna at free dot fr
Note this is Sybase not Mssql
 [2006-05-16 14:28 UTC] jplock at gmail dot com
In my case, this is happening with mssql compiled to FreeTDS as well.
 [2009-04-22 08:15 UTC] hexes at mail dot ru
I think that is bug of FreeTDS, tsql dont return row count! (in ver. 
Whene i update to FreeTDS 0.82 it start return row count at end of 
 [2009-04-27 15:52 UTC]
Please try using this CVS snapshot:
For Windows:

And update your freetds before you try the snapshot!
 [2009-05-05 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 10:01:30 2024 UTC