Replace inadequate $dbh->ping SQLite implementation (RT#78420)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / SQLite.pm
index 6943c77..309767f 100644 (file)
@@ -8,6 +8,7 @@ use mro 'c3';
 
 use DBIx::Class::Carp;
 use Scalar::Util 'looks_like_number';
+use Try::Tiny;
 use namespace::clean;
 
 __PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::SQLite');
@@ -91,6 +92,11 @@ sub _exec_svp_rollback {
   $self->_dbh->do("ROLLBACK TRANSACTION TO SAVEPOINT $name");
 }
 
+sub _ping {
+  my $self = shift;
+  try { $self->_dbh->do('SELECT * FROM sqlite_master LIMIT 1'); 1 };
+}
+
 sub deployment_statements {
   my $self = shift;
   my ($schema, $type, $version, $dir, $sqltargs, @rest) = @_;