#46657 [Opn]: MySQL PDO bindParam on Stored Procedure with INOUT fails to bind returned value
ID: 46657
User updated by: aventurella at gmail dot com
Reported By: aventurella at gmail dot com
Status: Open
Bug Type: PDO related
Operating System: OS X 10.5.5
PHP Version: 5.2.6
New Comment:
I guess this is the root of the problem for MySQL:
http://www.artfulsoftware.com/infotree/tip.php?id=130
Previous Comments:
------------------------------------------------------------------------
[2008-11-26 22:33:15] aventurella at gmail dot com
This also happens with PostgreSQL and MSSQL
http://bugs.php.net/bug.php?id=43887
------------------------------------------------------------------------
[2008-11-24 04:28:19] aventurella at gmail dot com
Description:
------------
Using the example in the PHP docs for binding an INOUT in a stored
procedure, the process appears to fail
http://us3.php.net/manual/en/pdo.prepared-statements.php
see example 5
The principle difference between this and Bug #35935 is that
$stmt->bindParam(1, $value, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT,
10);
In the code was not presented, which should address the issue.
Reproduce code:
---------------
MySQL 5.0.67
EITHER OF THE FOLLOWING:
1)
CREATE PROCEDURE tablename.sp_takes_string_returns_string(INOUT str
VARCHAR(10))
BEGIN
SELECT 'world' INTO str;
END;
2)
CREATE PROCEDURE tablename.sp_takes_string_returns_string(INOUT str
VARCHAR(10))
BEGIN
SET str = 'world'
END;
PHP:
$dbh = new PDO($server.':host='.$host.';dbname='.$catalog, $username,
$password, array(PDO::ATTR_PERSISTENT => true));
$stmt = $dbh->prepare("CALL sp_takes_string_returns_string(?)");
$value = 'hello';
$stmt->bindParam(1, $value, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT,
10);
// call the stored procedure
$stmt->execute();
print "procedure returned $value\n";
Expected result:
----------------
procedure returned world
Actual result:
--------------
procedure returned hello
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46657&edit=1
Thread (4 messages)