1#!/usr/bin/perl -w 2 3use strict; 4use warnings; 5use bigint; 6use DBI; 7use Data::Dumper; 8use File::Basename; 9use Try::Tiny; 10 11my $project = shift; 12$project =~ s/.*=(.*)/$1/; 13my $warns = shift; 14my $db_file = shift; 15 16my $db; 17 18sub 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 31sub 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 42connect_to_db($db_file); 43copy_constraints($0, $project); 44 45$db->commit(); 46$db->disconnect(); 47