Description
I am using execute_array on an array of 10000 elements. Even if that INSERT fails because of a lack of space in Oracle, execute_array and array tuples all indicate success; only the statement handle $sth->err() method shows the error. That violates the documented use of execute_array (checking the returned status and checking the tuples).
Set up for the code below: Create a table EXPERIMENTAL in a tablespace constrained to 10MB. The table has a single column, COL VARCHAR(2000).
use strict;
use DBD::Oracle;
my $dbh = DBI->connect("dbi:Oracle:", 'connect code', '', {RaiseError => 1,PrintError => 0,AutoCommit => 0,RowCacheSize => 1000}
) or die "Database connection could not be established: $DBI::errstr";
my $sth = $dbh->prepare( "insert into experimental values (?)" );
$sth->{RaiseError} = 0;
my $bigValue = ("x") x 1500;
my @BigArray = ($bigValue) x 10000;
my $ret = $sth->execute_array( {ArrayTupleStatus=>\my @tuple_status},@BigArray );
print "Inserted big array, got '$ret'\n";
if ( not $ ret ) {
foreach my $status (@tuple_status) {
$status = [0, "Skipped"] unless defined $status;
next unless ref $status;
print( "Failed to insert a row: $status->[1]\n" );
}
die "Failed on DB handling, going down";
}
use Data::Dumper; print Dumper @tuple_status;
print "Statement has ",$sth->err()," and ",$sth->errstr(),"\n";
I expect that this code will show a $ret of zero (false, undef, whatever). I expect that at least one of @tuple_status'es if a reference to an error message.
What I actually get is $ret=10000 and @tuple_status being all -1's; according to DBI docs and samples, I interpret it as "all successful", and that is not the case. Only the last print gives me
"Statement has 1653 and ORA-01653: unable to extend table ***.EXPERIMENTAL by 128 in tablespace EXPERIMENTAL (DBD ERROR: OCIStmtExecute)"
DBD::Oracle version is 1.74. Oracle version is 12 (both server and client).