Bug #21575 Stored Procedure with INOUT parm fails when called from PHP 5
Submitted: 10 Aug 2006 22:36 Modified: 14 Aug 2006 7:19
Reporter: Debbie Frazer Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.23 OS:Windows (XP)
Assigned to: Sveta Smirnova CPU Architecture:Any
Tags: INOUT, MYSQL5, PHP5, stored procedure

[10 Aug 2006 22:36] Debbie Frazer
Description:
I have a stored procedure:

delimiter //
drop procedure helloproc;
//
CREATE PROCEDURE helloproc (INOUT astr VARCHAR(100))
BEGIN
insert into dbmtest (select NOW(), astr);
set astr = 'all done again';
END;
//
delimiter ;

That I call successfully as follows from within MYSQL:

set @astr = 'One INOUT Parameter';
call helloproc(@astr);
select @astr;
select * from dbmtest;

However, I get an error when I try to execute from a PHP script:

$stmt=NULL;
$artn = 'String going in';
$stmt = $dbh->prepare("CALL helloproc(?)");
$stmt->bindParam(1, $artn, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 500); 
$stmt->execute();
print "proc returned $artn ";

The error is: 

Error!:SQLSTATE[HY000]: General error: 1414 OUT or INOUT argument 1 for routine dmeadows.helloproc is not a variable or NEW pseudo-variable in BEFORE trigger

How to repeat:
I get the error every time I run my PHP script.
[11 Aug 2006 6:26] Sveta Smirnova
Thank you for the report.

Which PDO driver do you use?
[11 Aug 2006 20:38] Debbie Frazer
I downloaded php-5.1.4-Win32.zip from the PHP website and extracted php_pdo.dll and php_pdo_mysql.dll.
[14 Aug 2006 7:19] Sveta Smirnova
http://www.php.net/manual/ru/ref.pdo-mysql.php says what pdo_mysql uses server side prepare statements or emulates they. But server side prepared statements do not support CALL yet: http://dev.mysql.com/doc/refman/5.1/en/sqlps.html