php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64640 PDO can't get output parameter value
Submitted: 2013-04-12 07:31 UTC Modified: 2016-11-11 19:27 UTC
Votes:9
Avg. Score:4.1 ± 0.9
Reproduced:7 of 7 (100.0%)
Same Version:2 (28.6%)
Same OS:0 (0.0%)
From: shllove at hotmail dot com Assigned:
Status: Not a bug Package: PDO Core
PHP Version: 5.4.14 OS: winxp sp3
Private report: No CVE-ID: None
 [2013-04-12 07:31 UTC] shllove at hotmail dot com
Description:
------------
---
From manual page: http://www.php.net/pdostatement.bindparam#refsect1-pdostatement.bindparam-description
---


Test script:
---------------
                $sql = "call `SP_Test`(?)";
		$stmt = $this->db->prepare($sql);
			
			
		$stmt->bindParam(1, $cnt, PDO::PARAM_INPUT_OUTPUT | PDO::PARAM_INT , 11);
		
		$stmt->execute();
		
		$rt = $stmt->fetchAll();

		echo "cnt: $cnt";
		
		$stmt->closeCursor();		
		
		echo "cnt: $cnt";


sp:
CREATE PROCEDURE `SP_Test`(
out resultCount int
)
BEGIN

     set resultCount=10;          

END;



Expected result:
----------------
cnt: 10

Actual result:
--------------
 Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1414 OUT or INOUT argument 1 for routine octpod.SP_Test is not a variable or NEW pseudo-variable in BEFORE trigger' 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-01 12:33 UTC] felipe@php.net
-Package: PDO related +Package: PDO Core
 [2016-11-11 19:27 UTC] adambaratz@php.net
-Status: Open +Status: Not a bug
 [2016-11-11 19:27 UTC] adambaratz@php.net
The error returned is a SQL syntax error. I tried running the CREATE query in SQL Server Management Studio -- I assume from the error you're using MSSQL -- and got a syntax error. So I don't think PDO has anything to do with the problem you're having.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC