note 34781 added to function.mssql-execute
| From: | brian_caughlin at hotmail dot com | Date: | Wed, 06 Aug 2003 16:04:42 +0000 |
| Subject: | note 34781 added to function.mssql-execute | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-53519@lists.php.net to get a copy of this message | ||
Regarding Output Parameters and RETVAL: A change that appears to have begun around 4.3.
According to the documentation and previously posted comments, if a stored procedure returns only
one Recordset, you could retrieve the RETVAL and Output Params right away. THIS IS NO LONGER THE
CASE. Beginning around 4.3, you must always use the mssql_next_result() function if any recordset
is returned at all.
If you consider the example posted below by fjortizATcomunetDOTes on 26-Dec-2001...
[...]
// Execute the Stored Proc
$result=mssql_execute($stmt);
// Get the recordset
$arr=mssql_fetch_row($result);
print ("Answer: " . $arr[0] . "
" );
// NEW for 4.3: Switch to the next Recordset
// Since there was only one recordset, it will return false...
mssql_next_result($result);
// And now RETVAL and Output Params are accessible...
print ("RETVAL = $val ; intval = $ival ; floatval = $fval ; string = $sval");
[...]
There is also another way, and that is to use a new optional skip parameter on the execute.
mssql_execute($stmt, true);
This appears to ignore any recordsets, allowing you to get at the retval and output parameters
immediately.
For more information, please see Bug #21089.
----
Manual Page -- http://www.php.net/manual/en/function.mssql-execute.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34781
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34781&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34781&report=yes