Does DBD::mysql implement the bind_param_inout method? I am getting the following error messages when trying it out:
DBD::mysql::st bind_param_inout failed: Output parameters not implemented [for Statement "call spCreateTransactionRecord(?, ?)" with ParamValues: 0=Null!, 1=Null!] at ./db.pl line 23
My code:
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use DBI qw(:sql_types);
use Data::Dumper;
my ($dbh, $dsn, $sth, $sql);
my ($RecID, TypeID);
my ($user, $pass) = '';
# Open DB connection
$dsn = "dbi:mysql:database=mp;mysql_read_default_file=$ENV{HOME}/.my.cnf";
$dbh = DBI->connect($dsn, $user, $pass,
{RaiseError=>1, AutoCommit=>0, ShowErrorStatement=>1})
|| die "DB open error: $DBI::errstr";
# Call stored procedure
$sql = "call spCreateTransactionRecord(?, ?)";
$sth = $dbh->prepare($sql);
$sth->bind_param_inout(2, \$p_RecID, 11, {TYPE=>SQL_INTEGER});
$sth->execute($p_TypeID) || print $sth->errstr;
# Disconnects
$dbh->commit();
$dbh->disconnect;
The stored procedures is declared as:
CREATE PROCEDURE spCreateTransactionRecord(IN p_TypeID INTEGER, OUT p_RecID INTEGER)