From: Rafael Kitover Date: Tue, 17 Feb 2009 21:58:34 +0000 (+0000) Subject: minor Oracle changes X-Git-Tag: v0.08240~110 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0f0abc979e2204878f1dd08a6b906102d490d665;p=dbsrgits%2FDBIx-Class.git minor Oracle changes --- diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index 4066c67..2e9a8c1 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -89,6 +89,10 @@ sub _sequence_fetch { Returns true if we have an open (and working) database connection, false if it is not (yet) open (or does not work). (Executes a simple SELECT to make sure it works.) +The reason this is needed is that L's ping() does not do a real +OCIPing but just gets the server version, which doesn't help if someone killed +your session. + =cut sub connected { @@ -120,24 +124,26 @@ sub _dbh_execute { my (@res, $exception, $retried); - do { - eval { - if ($wantarray) { - @res = $self->SUPER::_dbh_execute(@_); + RETRY: { + do { + eval { + if ($wantarray) { + @res = $self->SUPER::_dbh_execute(@_); + } else { + $res[0] = $self->SUPER::_dbh_execute(@_); + } + }; + $exception = $@; + if ($exception =~ /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); + delete $dbh->{CachedKids}{$sql}; } else { - $res[0] = $self->SUPER::_dbh_execute(@_); + last RETRY; } - }; - $exception = $@; - if ($exception =~ /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); - delete $dbh->{CachedKids}{$sql}; - } else { - last; - } - } while (not $retried++); + } while (not $retried++); + } $self->throw_exception($exception) if $exception;