db: store "too common" functions in the database
[smatch.git] / smatch_data / db / fill_db_sql.pl
blobc4d4deb25d6a8f2e8a6ede56b6e74e16798d036b
1 #!/usr/bin/perl -w
3 use strict;
4 use DBI;
6 my $project = shift;
7 my $warns = shift;
9 if (!defined($warns)) {
10 print "usage: $0 <project> <warns.txt>\n";
11 exit(1);
14 my $db = DBI->connect("dbi:SQLite:smatch_db.sqlite", "", "", {AutoCommit => 0});
15 $db->do("PRAGMA synchronous = OFF");
16 $db->do("PRAGMA cache_size = 800000");
17 $db->do("PRAGMA journal_mode = OFF");
18 $db->do("PRAGMA count_changes = OFF");
19 $db->do("PRAGMA temp_store = MEMORY");
20 $db->do("PRAGMA locking = EXCLUSIVE");
22 my ($dummy, $sql);
24 open(WARNS, "<$warns");
25 while (<WARNS>) {
27 if (!($_ =~ /^.*? [^ ]*\(\) SQL: /)) {
28 next;
30 ($dummy, $dummy, $sql) = split(/:/, $_, 3);
32 $db->do($sql);
35 $db->commit();
36 $db->disconnect();