php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43616 mssql_execute() stored procedure has no return value.
Submitted: 2007-12-17 13:24 UTC Modified: 2008-10-06 22:13 UTC
Votes:5
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:3 (60.0%)
Same OS:0 (0.0%)
From: ville dot tuomola at mehilainen dot fi Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.2.5 OS: Fedora 8
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: ville dot tuomola at mehilainen dot fi
New email:
PHP Version: OS:

 

 [2007-12-17 13:24 UTC] ville dot tuomola at mehilainen dot fi
Description:
------------
When executing a stored procedure with mssql_execute, it does not return  the return value of the procedure.

It does not matter whether the "skip_results" parameters is used in mssql_execute or not.

Reproduce code:
---------------
CREATE  PROC sp_Test

AS

RETURN 2

<?php
$myServer = "sqlserver";
$myUser = "dbuser";
$myPass = "pass";
$myDB = "db";

$s = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer");

mssql_select_db($myDB, $s) or die("Couldn't open database $myDB");

$proc = mssql_init("sp_Test", $s);

mssql_bind($proc, "RETVAL", $ret, SQLINT2);

//mssql_execute($proc);

mssql_execute($proc, true);

mssql_free_statement ($proc);
mssql_close($s);

echo "<h2>sp_Test returned: $ret</h2>";
?>

Expected result:
----------------
sp_Test returned: 2

Actual result:
--------------
Warning: mssql_execute() [function.mssql-execute]: stored procedure has no return value. Nothing was returned into RETVAL in /var/www/vkajanvaraus/htdocs/test.php on line 20
sp_Test returned: 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-28 20:13 UTC] ethan dot nelson at ltd dot org
Connecting to MSSQL 2000, I cannot get the return values from a user-defined function.  The number of rows comes through.  The column names comes through when I do fetch_array.  However, the values do not.  Same query returns values in query analyzer.

Further, testing showed that when a SQL view was created that selected * from the user defined function and added a derived column, such as 'test' = 1, the derived column's value comes through, but still the other values associated with the user-defined function do not.
 [2008-02-14 15:12 UTC] sven dot vandorpe at telenet dot be
Some additional information about this problem.

It seems that this is probably not PHP related.

I tested the procedure on PHP 5.1.6 that was compiled with FreeTDS 0.63:
The result was that the PHP script returned "2"

Afterwards I compiled FreeTDS 0.64 and recompiled PHP 5.1.6 so that it used the FreeTDS 0.64 libraries:
The result of the PHP script is now "0"

The error in the Apache error log:
"[Thu Feb 14 14:17:10 2008] [error] PHP Warning:  mssql_execute() [<a href='function.mssql-execute'>function.mssql-execute</a>]: stored procedure has no return value. Nothing was returned into RETVAL in /usr/share/nagios/share/test.php on line 18"

With kind regards,
Van Dorpe Sven
 [2008-02-15 12:35 UTC] sven dot vandorpe at telenet dot be
Hi,

Some additional information.

This issue is resolved when using FreeTDS v0.82RC1

With kind regards,
Van Dorpe Sven
 [2008-10-06 22:13 UTC] felipe@php.net
Thanks for the information.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 21:01:27 2024 UTC