From:             aventurella at gmail dot com
Operating system: OS X 10.5.5
PHP version:      5.2.6
PHP Bug Type:     PDO related
Bug description:  MySQL PDO bindParam on Stored Procedure with INOUT fails to 
bind returned value

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 bug report at http://bugs.php.net/?id=46657&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=46657&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=46657&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=46657&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=46657&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=46657&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=46657&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=46657&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=46657&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=46657&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=46657&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=46657&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=46657&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=46657&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=46657&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=46657&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=46657&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=46657&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=46657&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=46657&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=46657&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=46657&r=mysqlcfg

Reply via email to