fix segfault with old DBD::Sybase
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase / Base.pm
index d4e287e..29265fb 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 =head1 NAME
 
 DBIx::Class::Storage::DBI::Sybase::Base - Common functionality for drivers using
-L<DBD::Sybase>
+DBD::Sybase
 
 =head1 METHODS
 
@@ -24,17 +24,12 @@ active statement handle, leading to masked database errors.
 sub connected {
   my $self = shift;
 
-  my $super = eval { $self->next::method(@_) };
+  my $dbh = $self->_dbh or return 0;
+  $dbh->FETCH('Active') or return 0;
 
-  return $super unless $@;
-
-  my $dbh = $self->_dbh;
   local $dbh->{RaiseError} = 1;
-
   eval {
-    my $ping_sth = $dbh->prepare_cached("select 1");
-    $ping_sth->execute;
-    $ping_sth->finish;
+    $dbh->do('select 1');
   };
 
   return $@ ? 0 : 1;