CCCP-SQLiteWrap
view release on metacpan or search on metacpan
lib/CCCP/SQLiteWrap.pm view on Meta::CPAN
sub check {
my ($obj) = @_;
# check live connection
unless ($obj->db->ping()) {
return "Can't ping SQLite base from ".$obj->path."\n";
};
# check database structure
my $need_rebackup = 0;
my @table = $obj->show_tables;
foreach my $table (@table) {
next unless $table;
eval{$obj->db->selectall_arrayref("SELECT * FROM $table LIMIT 1")};
if ($DBI::errstr) {
$need_rebackup++;
last;
};
};
if ($need_rebackup) {
return "SQLite base from ".$obj->path." return error like 'database disk image is malformed' and goto re-dump";
return "Bug in re-dump SQLite" unless $obj->redump();
};
return;
}
sub db {$_[0]->{'db'}}
sub path {$_[0]->{'path'}}
( run in 1.402 second using v1.01-cache-2.11-cpan-49f99fa48dc )