bug in DBD::Oracle 1.19 execute_array
am 16.02.2007 18:21:43 von martinI think I've found a small bug in execute_array in DBD::Oracle 1.19 - it
is quite possibly my bug as I posted changes for execute_array some
time ago ;-)
If you call execute_array with an empty array list for one of the
parameters no rows are executed or inserted but execute_array returns 0
instead of 0E0. The following demonstrates:
eval {$dbh->do(q/drop table mytest/);};
$dbh->do(q/create table mytest (a int , b char(20))/);
my $sth = $dbh->prepare(q/insert into mytest values (?,?)/);
my @p2 = ();
my @tuple_status;
my ($executed, $inserted) = $sth->execute_array( { ArrayTupleStatus =>
\@tuple_status }, 1, \@p2 );
print "0E0\n" if ($executed eq '0E0');
print Data::Dumper->Dump([$executed, $inserted], [qw(executed
inserted)]),"\n";
print "tuple_status:\n" . Dumper(\@tuple_status) . "\n";
print "Error from execute_array - " . $sth->errstr . "\n" if (!$executed);
produces:
===================
$executed = 0;
$inserted = 0;
tuple_status:
$VAR1 = [];
Error from execute_array -
Use of uninitialized value in concatenation (.) or string at
execute_array1.pl line 38.
===================
The problem is in execute_array which needs changing as follows:
sub execute_for_fetch {
my ($sth, $fetch_tuple_sub, $tuple_status) = @_;
my $row_count = 0;
- my $tuple_count=0;
+ my $tuple_count="0E0";
my $tuple_batch_status;
my $dbh = $sth->{Database};
which makes the above script return correctly:
===================
0E0
$executed = '0E0';
$inserted = 0;
tuple_status:
$VAR1 = [];
===================
Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com