Edit report at https://bugs.php.net/bug.php?id=43887&edit=1
ID: 43887
Comment by: eugene dot trotsan at gmail dot com
Reported by: coldgrass at gmail dot com
Summary: mssql2005 PROCEDURE PDO::PARAM_INPUT_OUTPUT
Status: No Feedback
Type: Bug
Package: PDO related
Operating System: *
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
I can confirm that the same issue is present in version 5.3.3.
The value of $result in the following code snippet will not be changed after
the SP is run (even though the procedure returns a value when run from SQL
Server Management Studio / freetds / or via mssql_query()
$result = "";
$stmt = $pdo->prepare("exec sp_nextSerialNumGet ?")
$stmt->bindParam(8, $result, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 25);
$stmt->execute();
echo $result; // empty
OR
$execArray = array(':result' => "");
$stmt = $pdo->prepare("call sp_nextSerialNumGet (:result)");
$stmt->execute($execArray);
echo $stmt->fetch(); //empty, var_dump($stmt->fetchAll()) show array (0) {}
Previous Comments:
------------------------------------------------------------------------
[2009-12-22 21:53:58] david dot wright at opticsplanet dot com
This is happening for me in 5.3.1., using Pdo_Dblib. Trying to call a stored
procedure on SQL Server 2005 server. Cannot retrieve a value.
PHP version 5.3.1
Using Pdo_Dblib
Linux: 2.6.24-24-server SMP x86_64 GNU/Linux
PHP Code:
----------------------------
/** SNIP. Set up a valid $db here! **/
$return_value = 999;
$sth = $db->prepare("EXEC dbo.opsp_Test ?");
$sth->bindParam(1, $return_value, PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 4);
$sth->execute();
echo "$return_value\n";
Return value ALWAYS comes back as 999, no matter what variations I try in
bindParam call.
Here's my Stored Procedure:
---------------------------
CREATE PROCEDURE opsp_Test
@TheOutputValue int OUTPUT
AS
BEGIN
SET @TheOutputValue = 11
END
------------------------------------------------------------------------
[2009-05-03 01:00:06] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2009-04-25 14:54:04] [email protected]
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2008-11-26 22:39:06] aventurella at gmail dot com
forgot my php/OS version: 5.2.6 on OS X 10.5.5
------------------------------------------------------------------------
[2008-11-26 22:37:50] aventurella at gmail dot com
I can confrim this on MySQL and PostgreSQL as well. No PARAM_INPUT_OUTPUT
values get bound through PDO when running a stored
procedure.
http://bugs.php.net/bug.php?id=46657
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=43887
--
Edit this bug report at https://bugs.php.net/bug.php?id=43887&edit=1