X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FOracle%2FGeneric.pm;h=c107934024b81109180f6d0ffca3481b1e11cf23;hb=9720202815dbafee0d9e944e3f8258d4aca446d4;hp=256bbc9678470827170ba56fc5964342809d4e17;hpb=8273e845426f0187b4ad6c4a1b42286fa09a648f;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index 256bbc9..c107934 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -284,55 +284,47 @@ sub _ping { } sub _dbh_execute { - my ($self, $dbh, $sql, @args) = @_; + my ($self, $dbh, $sql, $bind) = @_; - my (@res, $tried); - my $want = wantarray; - my $next = $self->next::can; - do { - try { - my $exec = sub { - # Turn off sth caching for multi-part LOBs. See _prep_for_execute above. - local $self->{disable_sth_caching} = 1 - if first { - ($_->[0]{_ora_lob_autosplit_part}||0) - > (__cache_queries_with_max_lob_parts-1) - } @{ $args[0] }; - - $self->$next($dbh, $sql, @args) - }; + # Turn off sth caching for multi-part LOBs. See _prep_for_execute above. + local $self->{disable_sth_caching} = 1 if first { + ($_->[0]{_ora_lob_autosplit_part}||0) + > + (__cache_queries_with_max_lob_parts - 1) + } @$bind; - if (!defined $want) { - $exec->(); - } - elsif (! $want) { - $res[0] = $exec->(); - } - else { - @res = $exec->(); - } + my $next = $self->next::can; - $tried++; - } - catch { - if (! $tried and $_ =~ /ORA-01003/) { - # ORA-01003: no statement parsed (someone changed the table somehow, - # invalidating your cursor.) - delete $dbh->{CachedKids}{$sql}; - } - else { - $self->throw_exception($_); + # if we are already in a txn we can't retry anything + return shift->$next(@_) + if $self->transaction_depth; + + # cheat the blockrunner - we do want to rerun things regardless of outer state + local $self->{_in_do_block}; + + return DBIx::Class::Storage::BlockRunner->new( + storage => $self, + run_code => $next, + run_args => \@_, + wrap_txn => 0, + retry_handler => sub { + # ORA-01003: no statement parsed (someone changed the table somehow, + # invalidating your cursor.) + return 0 if ($_[0]->retried_count or $_[0]->last_exception !~ /ORA-01003/); + + # re-prepare towards new table data + if (my $dbh = $_[0]->storage->_dbh) { + delete $dbh->{CachedKids}{$_[0]->run_args->[2]}; } - }; - } while (! $tried++); - - return wantarray ? @res : $res[0]; + return 1; + }, + )->run; } -sub _dbh_execute_array { +sub _dbh_execute_for_fetch { #my ($self, $sth, $tuple_status, @extra) = @_; - # DBD::Oracle warns loudly on partial execute_array failures + # DBD::Oracle warns loudly on partial execute_for_fetch failures local $_[1]->{PrintWarn} = 0; shift->next::method(@_);