From 9e3287b0f9611af321b7cb1ca7b7757dbe96cfd2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 23 Jun 2015 13:25:22 +0100 Subject: [PATCH 1/1] Dgit.pm: poldb_setup: Provide hook function No users yet, so nfc. --- Debian/Dgit/Policy/Debian.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Debian/Dgit/Policy/Debian.pm b/Debian/Dgit/Policy/Debian.pm index 03118b1d..12f1ee11 100644 --- a/Debian/Dgit/Policy/Debian.pm +++ b/Debian/Dgit/Policy/Debian.pm @@ -27,12 +27,15 @@ sub poldb_path ($) { return "$repos/policy.sqlite3"; } -sub poldb_setup ($) { - my ($policydb) = @_; +sub poldb_setup ($;$) { + my ($policydb, $hook) = @_; $poldbh ||= DBI->connect("dbi:SQLite:$policydb",'','', { RaiseError=>1, PrintError=>1, AutoCommit=>0 }); + + $hook->() if $hook; + $poldbh->do("PRAGMA foreign_keys = ON"); } -- 2.30.2