php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39707 Sending more then one parameter to SP will not return output parameters
Submitted: 2006-12-01 18:00 UTC Modified: 2009-05-03 01:00 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:3 (75.0%)
From: aspen dot olmsted at alliance dot biz Assigned: wez (profile)
Status: No Feedback Package: PDO related
PHP Version: 5.2.0 OS: Windows XP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: aspen dot olmsted at alliance dot biz
New email:
PHP Version: OS:

 

 [2006-12-01 18:00 UTC] aspen dot olmsted at alliance dot biz
Description:
------------
I am trying to pass output parameters to MSSQL through PDO using the odbc driver.

If there is just one parameter it works.  If there is more than one it will not.

There is a sample to send an inout parameter to SQL on the pdo documentation page I used as a starting place

Reproduce code:
---------------
SQL:

ALTER PROCEDURE spReturn_Int @err int OUTPUT, @err2 varchar(255)
AS
SET @err = 11

  $sth = $dbh->prepare("EXECUTE spReturn_Int ?");
  $invalue = 'Dog';
  $sth->bindParam(1, $return_value, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT);
  $sth->bindParam(2, $invalue, PDO::PARAM_STR);
  $sth->execute();
  print "procedure returned $return_value\n";


Expected result:
----------------
It should print "procedure returned 11"

Actual result:
--------------
It prints "procedure returned 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-01 18:50 UTC] aspen dot olmsted at alliance dot biz
The line that says:
 $sth = $dbh->prepare("EXECUTE spReturn_Int ?");
should be:
 $sth = $dbh->prepare("EXECUTE spReturn_Int ?,?");

Sorry when I simplified the example I made this mistake
 [2007-07-23 06:52 UTC] ydiazc at gmail dot com
On the stores procedures not returned parameter of output or input output with php pdo and driver ODBC in both cases (sql server and oracle). 
PDO('odbc:Driver={Microsoft ODBC for Oracle}...
PDO('odbc:Driver={SQL Native Client}...

vote on the bug, is idem for both databases

the parameters of input or input output, They enter without problems to store procedure, But they do not go out with value of procedure.

help me !!!, I need to use multiple engines.

Thank you for his help
 [2007-08-02 12:28 UTC] aballard at gmail dot com
I believe Bug #42076 is the same as this. I found it first and tacked my comments there, but as this bug report is earlier and already assigned, I guess  I should be following this one.
 [2007-08-02 12:50 UTC] aballard at gmail dot com
I also appear to be unable to retrieve stored procedure return values.

SQL Procedure:
==================

CREATE PROCEDURE [dbo].[Write]
    @id varchar(255),
    @data varchar(4000)
AS

SET NOCOUNT ON

IF EXISTS(SELECT * FROM MyTable WHERE id = @id)
UPDATE MyTable SET
    data = @data
WHERE id = @id


ELSE
INSERT INTO MyTable (id, data)
VALUES (@id, @data)

RETURN @@ROWCOUNT
GO


PHP:
===================

	$stmt = $this->dbHandle->handle()->prepare("EXEC ? = dbo.WebSession_Write ?, ?");

	$stmt->bindParam(1, $return_value, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT);
	$stmt->bindParam(2, $sessID, PDO::PARAM_STR);
	$stmt->bindParam(3, $value, PDO::PARAM_STR);
	
	
	$stmt->execute();
	
	$stmt = null;
	
	if ($return_value == 1) {
		return true;
	} else {
		return false;
	}
 [2009-04-25 14:40 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-05-03 01:00 UTC] 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".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 21:01:30 2024 UTC