summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6feca0d)
raw | patch | inline | side by side (parent: 6feca0d)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 4 Mar 2009 09:11:03 +0000 (09:11 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 4 Mar 2009 09:11:03 +0000 (09:11 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13489 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-si/modules/DBsqlite.pm | patch | blob | history |
index 0e1da74f6c5ea6b8ad8f4d500ee0e6f28d8b0f19..cba1df5048b68f11099f541e3e5034c0287ef031 100644 (file)
my $lock = $db_name.".si.lock";
my $self = {dbh=>undef,db_name=>undef,db_lock=>undef,db_lock_handle=>undef};
my $dbh = DBI->connect("dbi:SQLite:dbname=$db_name", "", "", {RaiseError => 1, AutoCommit => 1});
+ my $sth = $dbh->prepare("pragma integrity_check");
+ $sth->execute();
+ my @ret = $sth->fetchall_arrayref();
+ if(length(@ret)==1 && $ret[0][0][0] eq 'ok') {
+ &main::daemon_log("DEBUG: Database image $db_name is ok", 7);
+ } else {
+ &main::daemon_log("ERROR: Database image $db_name is malformed, creating new database.", 1);
+ $sth->finish();
+ $dbh->disconnect();
+ unlink($db_name);
+ $dbh = DBI->connect("dbi:SQLite:dbname=$db_name", "", "", {RaiseError => 1, AutoCommit => 1});
+ }
$self->{dbh} = $dbh;
$self->{db_name} = $db_name;
$self->{db_lock} = $lock;