[Bast-commits] r5507 -
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Tue Feb 17 21:58:35 GMT 2009
Author: caelum
Date: 2009-02-17 21:58:34 +0000 (Tue, 17 Feb 2009)
New Revision: 5507
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
Log:
minor Oracle changes
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 2009-02-17 21:22:57 UTC (rev 5506)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2009-02-17 21:58:34 UTC (rev 5507)
@@ -89,6 +89,10 @@
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<DBD::Oracle>'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 @@
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;
More information about the Bast-commits
mailing list