conditions: don't parse NULLs
[smatch.git] / smatch_data / db / copy_required_constraints.pl
blobf32ee61a38d7a702942f90618dd7e69a25e9ea35
1 #!/usr/bin/perl -w
3 use strict;
4 use warnings;
5 use bigint;
6 use DBI;
7 use Data::Dumper;
8 use File::Basename;
9 use Try::Tiny;
11 my $project = shift;
12 $project =~ s/.*=(.*)/$1/;
13 my $warns = shift;
14 my $db_file = shift;
16 my $db;
18 sub connect_to_db($)
20 my $name = shift;
22 $db = DBI->connect("dbi:SQLite:$name", "", "", {AutoCommit => 0});
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");
31 sub copy_constraints($$)
33 my $full_path = shift;
34 my $project = shift;
35 my $dir = dirname($full_path);
37 $db->do('insert or ignore into constraints (str) select bound from constraints_required');
39 $db->commit();
42 connect_to_db($db_file);
43 copy_constraints($0, $project);
45 $db->commit();
46 $db->disconnect();