From: Peter Rabbitson Date: Wed, 26 May 2010 09:28:36 +0000 (+0000) Subject: Simplify oracle retrial logic X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=66efa982f30b374c3c12d1b01535c766a2e6e426;p=dbsrgits%2FDBIx-Class-Historic.git Simplify oracle retrial logic --- diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index dfe9da9..f3b178e 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -125,21 +125,14 @@ sub _dbh_execute { my $self = shift; my ($dbh, $op, $extra_bind, $ident, $bind_attributes, @args) = @_; - my $wantarray = wantarray; - my ($retried, @res); + my $retried; my $next = $self->next::can; - do { + while (1) { try { - if ($wantarray) { - @res = $self->$next($dbh, $op, $extra_bind, $ident, $bind_attributes, @args); - } - else { - $res[0] = $self->$next($dbh, $op, $extra_bind, $ident, $bind_attributes, @args); - } - $retried++; + return $self->$next($dbh, $op, $extra_bind, $ident, $bind_attributes, @args); } catch { - if (/ORA-01003/) { + if (!$retried++ and $_ =~ /ORA-01003/) { # ORA-01003: no statement parsed (someone changed the table somehow, # invalidating your cursor.) my ($sql, $bind) = $self->_prep_for_execute($op, $extra_bind, $ident, \@args); @@ -149,9 +142,7 @@ sub _dbh_execute { $self->throw_exception($_); } }; - } while (not $retried++); - - return $wantarray ? @res : $res[0]; + } } =head2 get_autoinc_seq