Skip Menu |

This queue is for tickets about the DBI CPAN distribution.

Report information
The Basics
Id: 6917
Status: resolved
Priority: 0/
Queue: DBI

People
Owner: Nobody in particular
Requestors: bzheng [...] us.nomura.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.38
Fixed in: (no value)



Subject: error with using bind_param_array with prepare_cached
code to reproduce error: .... $sth = $dbh->prepare_cached($strSQL); #bind 2x2 $sth->bind_param_array(1, [1,2]); $sth->bind_param_array(2, [1,2]); $tuples = $sth->execute_array({ ArrayTupleStatus => \@tuple_status }); $sth->finish(); $sth = $dbh->prepare_cached($strSQL); #bind 2x1 $sth->bind_param_array(1, [1]); #ERROR HERE: #Arrayref for parameter 1 has 1 elements but parameter 1 has 2 # $sth->bind_param_array(2, [1]); $tuples = $sth->execute_array({ ArrayTupleStatus => \@tuple_status }); $sth->finish(); .... reason might be that $sth->{ParamArrays} is not cleared by execute_array() or finish(). so the error occurs whenever the number of rows changes.
Thanks. For DBI 1.44 I've done this: Changed bind_param_array() so it doesn't require all bind arrays to have the same number of elements. Changed execute_array() definition, and default implementation, to effectively NULL-pad shorter bind arrays.