[Bast-commits] r9440 - DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Wed May 26 09:28:36 GMT 2010


Author: ribasushi
Date: 2010-05-26 10:28:36 +0100 (Wed, 26 May 2010)
New Revision: 9440

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
Log:
Simplify oracle retrial logic

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2010-05-25 19:36:28 UTC (rev 9439)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2010-05-26 09:28:36 UTC (rev 9440)
@@ -125,21 +125,14 @@
   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 @@
         $self->throw_exception($_);
       }
     };
-  } while (not $retried++);
-
-  return $wantarray ? @res : $res[0];
+  }
 }
 
 =head2 get_autoinc_seq




More information about the Bast-commits mailing list