Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RT72898 ora_array_chunk_size possibly broken #106

Open
mjegh opened this issue Jul 22, 2019 · 2 comments
Open

RT72898 ora_array_chunk_size possibly broken #106

mjegh opened this issue Jul 22, 2019 · 2 comments

Comments

@mjegh
Copy link
Member

mjegh commented Jul 22, 2019

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

@mjegh mjegh changed the title RT72898 ora_array_chunk_size possibly broken RT772898 ora_array_chunk_size possibly broken Jul 22, 2019
@mjegh mjegh changed the title RT772898 ora_array_chunk_size possibly broken RT72898 ora_array_chunk_size possibly broken Jul 22, 2019
@djzort
Copy link
Collaborator

djzort commented Jul 24, 2019

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

@djzort
Copy link
Collaborator

djzort commented Jul 24, 2019

I actually think the ||= should be just || as otherwise the $sth changes the $dbh as a silent side effect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants