Originally reported by Giuseppe Maxia at
http://bugs.mysql.com/bug.php?id=23554
Description:
The DBI defines a method "bind_param_inout" to handle IN and INOUT
parameters with stored procedures.
The underlying drivers should implement such method. However, DBD::mysql
does not.
If we want to use stored procedures with IN and INOUT parameters, we
need such method to be implemented.
If you try to use it, it will issue this error:
DBD::mysql::st bind_param_inout failed: Output parameters not
implemented ...
How to repeat:
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $dbh = DBI->connect("DBI:mysql:test"
. ";mysql_read_default_file=$ENV{HOME}/.my.cnf",
undef,
undef,
{RaiseError => 1})
or die "can't connect\n";
my $query = qq{ call some_proc(?) };
my $sth = $dbh->prepare($query);
my $param = 1;
$sth->bind_param_inout(1, \$param, 1);
$sth->execute();
Suggested fix:
A workaround is possible, with user variables.
my $param = 1;
$dbh->do(qq{SET \@result = ? }, undef, $param);
my $query = qq{call some_proc(\@result)};
my $sth = $dbh->prepare($query);
$sth->execute();
my ($result) = $dbh->selectrow_array(qq{select \@result});