php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27880 Problem with RETVAL after execute
Submitted: 2004-04-06 03:13 UTC Modified: 2004-04-06 22:01 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: v at sas dot nsk dot su Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.3.5 OS: WinXP Professional MSSQL 2k
Private report: No CVE-ID: None
 [2004-04-06 03:13 UTC] v at sas dot nsk dot su
Description:
------------
Hello!
Please take a look for next script:
create procedure test
@inp1 int
as begin
	if @inp1 >10
		return 10
		return @inp1;
end
go

This SP just returing values. nothing more. 
I cannot return record sets - I use this SP from PHP and from another SP.


This is a bug? 
How I can get RETVAL from SP?


Thank you. Vladimir




Reproduce code:
---------------
<?
$db=mssql_connect('localhost', '****', '***');
mssql_select_db('mpo');
$stmt = mssql_init ('test');
$ret=0;
$inp1=7;
mssql_bind($stmt,'RETVAL',&$ret, SQLINT4);
mssql_bind($stmt,'@inp1',$inp1, SQLINT4);
$res=mssql_execute($stmt);
echo "@inp1=".$inp1."\n";
echo "RETVAL=".$ret."\n";
echo "Res is:\n";
print_r($res);
echo "\nnext test:\n";
$inp1=64;
$stmt = mssql_init ('test');
mssql_bind($stmt,'RETVAL',&$ret, SQLINT4);
mssql_bind($stmt,'@inp1',$inp1, SQLINT4);
$res=mssql_execute($stmt);
echo "@inp1=".$inp1."\n";
echo "RETVAL=".$ret."\n";
echo "Res is:\n";
print_r($res);
echo "\ndone\n";
?


Expected result:
----------------
@inp1=7
RETVAL=7
Res is:
1
next test:
@inp1=64
RETVAL=10
Res is:
1
done


Actual result:
--------------
@inp1=7
RETVAL=0
Res is:
1
next test:
@inp1=64
RETVAL=0
Res is:
1
done


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-06 05:15 UTC] v at sas dot nsk dot su
I inspect function in ext/mssql/php_mssql.c
void _mssql_get_sp_result(...)
in line: 
	num_rets = dbnumrets(mssql_ptr->link);
num_rets stay as zero.

may be I made some wrong?
Please help!
 [2004-04-06 22:01 UTC] v at sas dot nsk dot su
I test it with fresh 4.3.6 RC2 
Working fine.
So, I took souces for php_mssql module from 4.3.6 RC 2 and compile it for 4.3.5. 
all going. fine. 
Thank all!
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Sep 26 23:05:52 2022 UTC