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.