1 #!/usr/bin/perl -w
2
3 use strict;
4 use warnings;
5 use bigint;
6 use DBI;
7 use Data::Dumper;
8 use File::Basename;
9 use Try::Tiny;
10
11 my $project = shift;
12 $project =~ s/.*=(.*)/$1/;
13 my $warns = shift;
14 my $db_file = shift;
15
16 my $db;
17
18 sub connect_to_db($)
19 {
20 my $name = shift;
21
22 $db = DBI->connect("dbi:SQLite:$name", "", "", {AutoCommit => 0});
23
24 $db->do("PRAGMA cache_size = 800000");
25 $db->do("PRAGMA journal_mode = OFF");
26 $db->do("PRAGMA count_changes = OFF");
27 $db->do("PRAGMA temp_store = MEMORY");
28 $db->do("PRAGMA locking = EXCLUSIVE");
29 }
30
31 sub copy_constraints($$)
32 {
33 my $full_path = shift;
34 my $project = shift;
35 my $dir = dirname($full_path);
36
37 $db->do('insert or ignore into constraints (str) select bound from constraints_required');
38
39 $db->commit();
40 }
41
42 connect_to_db($db_file);
43 copy_constraints($0, $project);
44
45 $db->commit();
46 $db->disconnect();