From: v at sas dot nsk dot su
Operating system: WinXP Professional MSSQL 2k
PHP version: 4.3.5
PHP Bug Type: MSSQL related
Bug description: Problem with RETVAL after execute
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
--
Edit bug report at http://bugs.php.net/?id=27880&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27880&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27880&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27880&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27880&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27880&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27880&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27880&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27880&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27880&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27880&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27880&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27880&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27880&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27880&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27880&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27880&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27880&r=float