Print this page
11506 smatch resync


  17 sub connect_to_db($)
  18 {
  19     my $name = shift;
  20 
  21     $db = DBI->connect("dbi:SQLite:$name", "", "", {AutoCommit => 0});
  22 
  23     $db->do("PRAGMA cache_size = 800000");
  24     $db->do("PRAGMA journal_mode = OFF");
  25     $db->do("PRAGMA count_changes = OFF");
  26     $db->do("PRAGMA temp_store = MEMORY");
  27     $db->do("PRAGMA locking = EXCLUSIVE");
  28 }
  29 
  30 sub load_manual_constraints($$)
  31 {
  32     my $full_path = shift;
  33     my $project = shift;
  34     my $dir = dirname($full_path);
  35     my ($data, $op, $limit);
  36 




  37     open(FILE, "$dir/$project.constraints_required");
  38     while (<FILE>) {
  39         ($data, $op, $limit) = split(/,/);
  40         $op =~ s/ //g;
  41         $limit =~ s/^ +//;
  42         $limit =~ s/\n//;
  43         $db->do("insert into constraints_required values (?, ?, ?);", undef, $data, $op, $limit);
  44     }
  45     close(FILE);
  46 
  47     $db->commit();
  48 }
  49 
  50 connect_to_db($db_file);
  51 load_manual_constraints($0, $project);
  52 
  53 $db->commit();
  54 $db->disconnect();


  17 sub connect_to_db($)
  18 {
  19     my $name = shift;
  20 
  21     $db = DBI->connect("dbi:SQLite:$name", "", "", {AutoCommit => 0});
  22 
  23     $db->do("PRAGMA cache_size = 800000");
  24     $db->do("PRAGMA journal_mode = OFF");
  25     $db->do("PRAGMA count_changes = OFF");
  26     $db->do("PRAGMA temp_store = MEMORY");
  27     $db->do("PRAGMA locking = EXCLUSIVE");
  28 }
  29 
  30 sub load_manual_constraints($$)
  31 {
  32     my $full_path = shift;
  33     my $project = shift;
  34     my $dir = dirname($full_path);
  35     my ($data, $op, $limit);
  36 
  37     if ($project =~ /^$/) {
  38         return;
  39     }
  40 
  41     open(FILE, "$dir/$project.constraints_required");
  42     while (<FILE>) {
  43         ($data, $op, $limit) = split(/,/);
  44         $op =~ s/ //g;
  45         $limit =~ s/^ +//;
  46         $limit =~ s/\n//;
  47         $db->do("insert into constraints_required values (?, ?, ?);", undef, $data, $op, $limit);
  48     }
  49     close(FILE);
  50 
  51     $db->commit();
  52 }
  53 
  54 connect_to_db($db_file);
  55 load_manual_constraints($0, $project);
  56 
  57 $db->commit();
  58 $db->disconnect();