Print this page
11506 smatch resync


  29 
  30 sub connect_to_db($)
  31 {
  32     my $name = shift;
  33 
  34     $db = DBI->connect("dbi:SQLite:$name", "", "", {AutoCommit => 0});
  35 
  36     $db->do("PRAGMA cache_size = 800000");
  37     $db->do("PRAGMA journal_mode = OFF");
  38     $db->do("PRAGMA count_changes = OFF");
  39     $db->do("PRAGMA temp_store = MEMORY");
  40     $db->do("PRAGMA locking = EXCLUSIVE");
  41 }
  42 
  43 sub load_manual_constraints($$)
  44 {
  45     my $full_path = shift;
  46     my $project = shift;
  47     my $dir = dirname($full_path);
  48 




  49     open(FILE, "$dir/$project.constraints");
  50     while (<FILE>) {
  51         s/\n//;
  52         $db->do("insert or ignore into constraints (str) values ('$_')");
  53     }
  54     close(FILE);
  55 
  56     open(FILE, "$dir/$project.constraints_required");
  57     while (<FILE>) {
  58         my $limit;
  59         my $dummy;
  60 
  61         ($dummy, $dummy, $limit) = split(/,/);
  62         $limit =~ s/^ +//;
  63         $limit =~ s/\n//;
  64         try {
  65             $db->do("insert or ignore into constraints (str) values ('$limit')");
  66         } catch {}
  67     }
  68     close(FILE);


  29 
  30 sub connect_to_db($)
  31 {
  32     my $name = shift;
  33 
  34     $db = DBI->connect("dbi:SQLite:$name", "", "", {AutoCommit => 0});
  35 
  36     $db->do("PRAGMA cache_size = 800000");
  37     $db->do("PRAGMA journal_mode = OFF");
  38     $db->do("PRAGMA count_changes = OFF");
  39     $db->do("PRAGMA temp_store = MEMORY");
  40     $db->do("PRAGMA locking = EXCLUSIVE");
  41 }
  42 
  43 sub load_manual_constraints($$)
  44 {
  45     my $full_path = shift;
  46     my $project = shift;
  47     my $dir = dirname($full_path);
  48 
  49     if ($project =~ /^$/) {
  50         return;
  51     }
  52 
  53     open(FILE, "$dir/$project.constraints");
  54     while (<FILE>) {
  55         s/\n//;
  56         $db->do("insert or ignore into constraints (str) values ('$_')");
  57     }
  58     close(FILE);
  59 
  60     open(FILE, "$dir/$project.constraints_required");
  61     while (<FILE>) {
  62         my $limit;
  63         my $dummy;
  64 
  65         ($dummy, $dummy, $limit) = split(/,/);
  66         $limit =~ s/^ +//;
  67         $limit =~ s/\n//;
  68         try {
  69             $db->do("insert or ignore into constraints (str) values ('$limit')");
  70         } catch {}
  71     }
  72     close(FILE);