Bug #23554 Add support for IN and INOUT parameters to DBD::mysql
Submitted: 23 Oct 2006 15:13 Modified: 21 Feb 2013 21:59
Reporter: Giuseppe Maxia Email Updates:
Status: Unsupported Impact on me:
Category:Connectors: DBD::mysql ( Perl ) Severity:S4 (Feature request)
Version:all OS:Any (all)
Assigned to: CPU Architecture:Any
Tags: DBD::MySQL, stored procedures

[23 Oct 2006 15:13] Giuseppe Maxia
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:
use strict;
use warnings;
use DBI;

my $dbh = DBI->connect("DBI:mysql:test"
        . ";mysql_read_default_file=$ENV{HOME}/.my.cnf",
        {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);

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);

my ($result) = $dbh->selectrow_array(qq{select \@result});
[3 May 2012 19:59] Christopher Fitzner
Wow, 5 years later and this still isn't done?
[21 Feb 2013 21:59] Sveta Smirnova
Thank you for the report.

We don't work on DBD::mysql bugs anymore. All its bugs should go to CPAN: https://rt.cpan.org/Public/Dist/Display.html?Name=DBD-mysql

I re-submitted your report to https://rt.cpan.org/Public/Bug/Display.html?id=83519
Please subscribe to the new report on CPAN and work with DBD::mysql developers in case if they need additional details.