Commit 26e84af7 authored by Gavin Brown's avatar Gavin Brown

use DBI's transaction handling rather than manually starting/committing

parent aba7b572
......@@ -32,6 +32,9 @@ my $db = DBI->connect(
$config->{'db.dsn'},
$config->{'db.user'},
$config->{'db.pass'},
{
'AutoCommit' => 0,
},
);
my $fssth = $db->prepare("SELECT COUNT(1) FROM files WHERE (filename=?)");
......@@ -42,8 +45,6 @@ my $disth = $db->prepare("INSERT INTO data
(host, start, end, zone, family, proto, rcode, queries)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
$db->do("BEGIN TRANSACTION");
my @families = qw(4 6);
my @protos = qw(udp tcp);
my @rcodes = keys(%Net::DNS::rcodesbyname);
......@@ -80,7 +81,7 @@ if ($stdin) {
}
}
$db->do("COMMIT TRANSACTION");
$db->commit;
syslog(LOG_DEBUG, "done");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment