my $dbh = $self->_dbh or return 0;
local $dbh->{RaiseError} = 1;
+ local $dbh->{PrintError} = 0;
eval {
$dbh->do('select 1 from rdb$database');
return $self->_sql_maker;
}
+sub _ping {
+ my $self = shift;
+
+ my $dbh = $self->_dbh or return 0;
+
+ local $dbh->{RaiseError} = 1;
+ local $dbh->{PrintError} = 0;
+
+ eval {
+ $dbh->do('select 1');
+ };
+
+ return $@ ? 0 : 1;
+}
+
1;
=head1 NAME
my $dbh = $self->_dbh or return 0;
local $dbh->{RaiseError} = 1;
+ local $dbh->{PrintError} = 0;
eval {
- $dbh->do("select 1 from dual");
+ $dbh->do('select 1 from dual');
};
return $@ ? 0 : 1;
ok (! $schema2->storage->connected, 'a re-connected cloned schema starts unconnected');
}
+$schema->storage->_dbh->disconnect;
+
+lives_ok {
+ $schema->storage->dbh_do(sub { $_[1]->do('select 1') })
+} '_ping works';
+
$schema->storage->dbh_do (sub {
my ($storage, $dbh) = @_;
eval { $dbh->do("DROP TABLE artist") };
isa_ok($schema->storage, "DBIx::Class::Storage::$storage_type");
-# start disconnected to test reconnection
+# start disconnected to test _ping
$schema->storage->_dbh->disconnect;
- my $dbh;
- lives_ok (sub {
- $dbh = $schema->storage->dbh;
- }, 'reconnect works');
+ lives_ok {
+ $schema->storage->dbh_do(sub { $_[1]->do('select 1') })
+ } '_ping works';
+
+ my $dbh = $schema->storage->dbh;
$dbh->do("IF OBJECT_ID('artist', 'U') IS NOT NULL
DROP TABLE artist");