note 78962 added to ref.pdo
| From: | xorinox at vtxmail dot ch | Date: | Sun, 04 Nov 2007 23:52:25 +0000 |
| Subject: | note 78962 added to ref.pdo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132002@lists.php.net to get a copy of this message | ||
I have seen a lot of user struggling with calling mysql procedures with in/out/inout parameters
using bindParam. There seems to be a bug or missing feature within the mysql C api. This at least I
could find out after reading a lot of posts at different places...
At the moment I workaround it like below. $con is a PDO object:
<?php
//in
$proc = $con->prepare( "call proc_in( @i_param )" );
$con->query( "set @i_param = 'myValue'" );
$proc->execute();
//out
$proc = $con->prepare( "call proc_out( @o_param )" );
$proc->execute();
$o_param = $con->query( "select @o_param" )->fetchColumn();
//inout
$proc = $con->prepare( "call proc_inout( @io_param )" );
$con->query( "set @io_param = 'myValue'" );
$proc->execute();
$io_param = $con->query( "select @io_param" )->fetchColumn();
?>
----
Server IP: 194.153.94.10
Probable Submitter: 84.72.171.123
----
Manual Page -- http://www.php.net/manual/en/ref.pdo.php
Edit -- https://master.php.net/note/edit/78962
Del: integrated -- https://master.php.net/note/delete/78962/integrated
Del: useless -- https://master.php.net/note/delete/78962/useless
Del: bad code -- https://master.php.net/note/delete/78962/bad+code
Del: spam -- https://master.php.net/note/delete/78962/spam
Del: non-english -- https://master.php.net/note/delete/78962/non-english
Del: in docs -- https://master.php.net/note/delete/78962/in+docs
Del: other reasons-- https://master.php.net/note/delete/78962
Reject -- https://master.php.net/note/reject/78962
Search -- https://master.php.net/manage/user-notes.php