Re: Perl script excessively executing statement
"Martin J. Evans" via dbi-users <[email protected]> Tue, 18 Feb 2020 09:48:06 +0000
| Newsgroups | gmane.comp.lang.perl.modules.dbi.general |
|---|---|
| Organization | at home |
| Message-ID | <[email protected]> |
On 18/02/2020 07:57, JohnD Blackburn wrote:
> After reviewing the log4perl output from DBIx when running this script I found the following perl module being executed:
>
> /usr/local/lib64/perl5/DBD/Oracle.pm
>
> Which contains the following subroutine:
>
> sub execute_for_fetch {
> my ($sth, $fetch_tuple_sub, $tuple_status) = @_;
> my $row_count = 0;
> my $err_total = 0;
> my $tuple_count="0E0";
> my $tuple_batch_status;
> my $dbh = $sth->{Database};
> my $batch_size =($dbh->{'ora_array_chunk_size'}||= 1000);
> if(defined($tuple_status)) {
> @$tuple_status = ();
> $tuple_batch_status = [ ];
> }
>
> my $finished;
> while (1) {
> my @tuple_batch;
> for (my $i = 0; $i < $batch_size; $i++) {
> $finished = $fetch_tuple_sub->();
> push @tuple_batch, [@{$finished || last}];
>
> }
> last unless @tuple_batch;
>
> my $err_count = 0;
> my $res = ora_execute_array($sth,
> \@tuple_batch,
> scalar(@tuple_batch),
> $tuple_batch_status,
> $err_count );
>
> if (defined($res)) { #no error
> $row_count += $res;
> }
> else {
> $row_count = undef;
> }
>
> $err_total += $err_count;
>
> $tuple_count+=@tuple_batch;
> push @$tuple_status, @$tuple_batch_status
> if defined($tuple_status);
>
> last if !$finished;
>
> }
> #error check here
> return $sth->set_err($DBI::stderr, "executing $tuple_count generated $err_total errors")
> if $err_total;
>
> return wantarray
> ? ($tuple_count, defined $row_count ? $row_count : undef)
> : $tuple_count;
>
> }
>
>
>
> Is that "while(1)" loop a potential contender for causing this?
>
>
Not unless you are using execute_array. The code you posted didn't look
like it was.
Martin
--
Martin J. Evans
Wetherby, UK