php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19370 Stored procedure with multiple row sets
Submitted: 2002-09-12 04:03 UTC Modified: 2002-12-03 12:58 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: pvy at novosoft dot ru Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.2.3 OS: windows 2000/sp3
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pvy at novosoft dot ru
New email:
PHP Version: OS:

 

 [2002-09-12 04:03 UTC] pvy at novosoft dot ru
Hello!
I create next procedure in MSSQL 7.0:
CREATE PROCEDURE z_test AS
begin
	select 1
	select 2
	select 3
       
        return 2003
end

then I wrote next script:
<?php
error_reporting(32767);
mssql_connect ( '***', '*****','******' );
mssql_select_db('my_db');
for ($i=1; $i<5; $i++) {
	$stmt=mssql_init("z_test");
	$result=mssql_execute($stmt);
        mssql_free_result($result);
}
?>


and got next answer from php:
Warning:  mssql_execute:  multiple recordsets from a stored procedure not supported yet! (Skipping...) in D:\project
s\eve\htdocs\mssql.php on line 9
Warning:  MS SQL:  stored procedure execution failed. in D:\projects\eve\htdocs\mssql.php on line 9

Warning:  mssql_free_result(): supplied argument is not a valid MS SQL-result resource in D:\projects\eve\htdocs\mss
ql.php on line 9
Warning:  MS SQL:  unable to init stored procedure in D:\projects\eve\htdocs\mssql.php on line 9
Warning:  mssql_execute(): supplied argument is not a valid MS SQL-Statement resource in D:\projects\eve\htdocs\mssq
l.php on line 9
Warning:  mssql_free_result(): supplied argument is not a valid MS SQL-result resource in D:\projects\eve\htdocs\mss
ql.php on line 9
Warning:  MS SQL:  unable to init stored procedure in D:\projects\eve\htdocs\mssql.php on line 9
Warning:  mssql_execute(): supplied argument is not a valid MS SQL-Statement resource in D:\projects\eve\htdocs\mssq
l.php</b> on line 9
Warning:  mssql_free_result(): supplied argument is not a valid MS SQL-result resource in D:\projects\eve\htdocs\mss
ql.php on line 9


As I understand this log - first time _execute function get normal result resource but in next we see "unable to init" error.

How I can clear old result set for prevent these errors?

and also, how I can get number in  'return' string?

Thanks in advise,
Vladimir.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-03 12:58 UTC] fmk@php.net
In PHP 4.3.0 this will be changed so multiple results are allowd in storred procedures.

The code to access both results and return values would look like this:

$stmt=mssql_init("z_test");
mssql_bind($stmt, "RETVAL", &$retval, SQLINT4);
$result=mssql_execute($stmt);
do {
	while ($row = mssql_fetch_assoc($result))
		print_r($row);
} while (mssql_next_result($result));
print($retval);
mssql_free_result($result);

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC