DBD-Oracle
DBD-Oracle copied to clipboard
RT72898 ora_array_chunk_size possibly broken
Pasted from RT:
I've not tested this yet but I thought it was worth reporting and I'll look at it myself. I copied DBD::Oracle's code for execute_for_fetch as a starter for implementing this in DBD::ODBC but had problems setting the chunk size. The code:
sub execute_for_fetch {
my ($sth, $fetch_tuple_sub, $tuple_status) = @_;
my $row_count = 0;
my $err_count = 0;
my $tuple_count="0E0";
my $tuple_batch_status;
my $dbh = $sth->{Database};
my $batch_size =($dbh->{'ora_array_chunk_size'}||= 1000);
probably always sets $batch_size to 1000 as $dbh->{'ora_array_chunk_size'} probably always returns undef. I think it should be $dbh->FETCH('ora_array_chunk_size').
I will check this.
and
On Fri Dec 02 15:47:18 2011, MJEVANS wrote: Show quoted text As it happens this does work because it is preceded by:
my $dbh = $sth->{Database};
However, I'd expect you to be able to set this on a statement handle not globabally across all the connection.
Martin
I think this is correct as an attribute of $dbh Adjusting it per $sth would require something like:
my $batch_size = do {
$sth->{'ora_array_chunk_size'} || $dbh->{'ora_array_chunk_size'}
|| 1000};
Either || or ||= depending on how you see the world. Having $sth set something in the more global $dbh is a bit side effectish for my tastes.
This would also require the infrastructure to get/set it on a per $sth basis. I think all thats required is to add it to the "private_attribute_info" for ::st on line 1229
The actually value seems to only be used as a control for the loop on line 1188
In general, im not certain there is much utility to controlling this per $sth
I actually think the ||= should be just || as otherwise the $sth changes the $dbh as a silent side effect