From: janw Date: Tue, 15 Jan 2008 10:14:33 +0000 (+0000) Subject: Added Transation statements. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=747b5ee03b2cb378c8a403f3ccf584b3302edf00;p=gosa.git Added Transation statements. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8345 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/modules/DBsqlite.pm b/gosa-si/modules/DBsqlite.pm index 21d720071..97e843506 100644 --- a/gosa-si/modules/DBsqlite.pm +++ b/gosa-si/modules/DBsqlite.pm @@ -90,7 +90,7 @@ sub add_dbentry { } } - my $sql_statement = " INSERT INTO $table VALUES ('".join("', '", @add_list)."')"; + my $sql_statement = "BEGIN TRANSACTION; INSERT INTO $table VALUES ('".join("', '", @add_list)."'); COMMIT;"; my $db_res = $obj->{dbh}->do($sql_statement); if( $db_res != 1 ) { return 1; @@ -168,7 +168,7 @@ sub update_dbentry { $update_statement .= join(', ', @update_list); } - my $sql_statement = "UPDATE $table SET $update_statement $where_statement"; + my $sql_statement = "BEGIN TRANSACTION; UPDATE $table SET $update_statement $where_statement; COMMIT;"; my $db_answer = $obj->{dbh}->do($sql_statement); return $db_answer; } @@ -204,7 +204,7 @@ sub del_dbentry { $where_statement = "WHERE ".join(' AND ', @del_list); } - my $sql_statement = "DELETE FROM $table $where_statement"; + my $sql_statement = "BEGIN TRANSACTION; DELETE FROM $table $where_statement; COMMIT;"; my $db_res = $obj->{dbh}->do($sql_statement); return $db_res; diff --git a/gosa-si/modules/GosaPackages.pm b/gosa-si/modules/GosaPackages.pm index b53919b5d..278752c50 100644 --- a/gosa-si/modules/GosaPackages.pm +++ b/gosa-si/modules/GosaPackages.pm @@ -333,7 +333,7 @@ sub process_incoming_msg { if ($out_msg =~ /(\d*?)<\/jobdb_id>/) { my $job_id = $1; - my $sql = "UPDATE '$main::job_queue_table_name' SET status='done', result='$out_msg' WHERE id='$job_id'"; + my $sql = "BEGIN TRANSATION; UPDATE '$main::job_queue_table_name' SET status='done', result='$out_msg' WHERE id='$job_id'; COMMIT;"; my $res = $main::job_db->exec_statement($sql); return;