Code

Applied patch from upstream trunk, changeset:13477
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 2 Mar 2009 10:45:50 +0000 (10:45 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 2 Mar 2009 10:45:50 +0000 (10:45 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13482 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-si/modules/DBsqlite.pm

index 541dfbb77105e72af54d90245520d5b8cadc0e3d..0e1da74f6c5ea6b8ad8f4d500ee0e6f28d8b0f19 100644 (file)
@@ -16,11 +16,6 @@ sub new {
        my $db_name = shift;
 
        my $lock = $db_name.".si.lock";
-       # delete existing lock - instance should be running only once
-       if(stat($lock)) {
-               &main::daemon_log("DEBUG: Removed existing lock file $lock.", 7);
-               unlink($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});
        $self->{dbh} = $dbh;
@@ -330,6 +325,7 @@ sub exec_statementlist {
 
        foreach my $sql (@$sql_list) {
                if(defined($sql) && length($sql) > 0) {
+                       # Obtain a new lock for each statement to not block the db for a too long time
                        $self->lock();
                        eval {
                                my @answer = @{$self->{dbh}->selectall_arrayref($sql)};