Permalink
Browse files

db: create view with 2.6.28 errors

To eliminate some WHEREs.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
  • Loading branch information...
1 parent cece289 commit 2142a05596bbd30f275dd2f1a81ebf8eab7fb4a0 @jirislaby committed Mar 12, 2012
View
2 bug-database/db_build/coverity_filler.pl
@@ -123,7 +123,7 @@ ($$$)
close INPUT;
-my $data = $dbh->prepare("INSERT INTO error(user, error_type, project, " .
+my $data = $dbh->prepare("INSERT INTO error_full(user, error_type, project, " .
"project_version, loc_file, loc_line, marking) " .
"VALUES (?, ?, ?, ?, ?, ?, ?)") ||
die "cannot prepare INSERT: " . DBI::errstr;
View
2 bug-database/db_build/prepare_db.pl
@@ -132,7 +132,7 @@
"sections or interrupt handlers", undef) ||
die "cannot INSERT error_type: " . DBI::errstr;
-#$data = $dbh->prepare("INSERT INTO error(user, error_type, error_subtype, " .
+#$data = $dbh->prepare("INSERT INTO error_full(user, error_type, error_subtype, " .
# "project, project_version, note, loc_file, loc_line, url, " .
# "marking) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") ||
# die "cannot INSERT error: " . DBI::errstr;
View
2 bug-database/db_build/stanse_filler.pl
@@ -67,7 +67,7 @@
print "tool ID: $tool_id\n";
print "note: $note\n" if (defined $note);
-my $data = $dbh->prepare("INSERT INTO error(user, error_type, project, " .
+my $data = $dbh->prepare("INSERT INTO error_full(user, error_type, project, " .
"project_version, loc_file, loc_line, marking, note) " .
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)") ||
die "cannot prepare INSERT: " . DBI::errstr;
View
15 bug-database/db_build/web_crawler.pl
@@ -47,19 +47,6 @@
die "user not found in the database" unless (defined $hash);
my $user_id = ${$hash}{id};
-$data = $dbh->prepare("INSERT INTO tool(name, version, description) " .
- "VALUES (?, ?, ?)") ||
- die "cannot INSERT tool: " . DBI::errstr;
-my $ret = $data->execute($tool_name, $tool_ver, "Crawls web and searches for " .
- "reported errors.");
-unless (defined $ret) {
- print "XX=", $dbh->err, "\n";
-# foreach my $key (keys %{$dbh->err}) {
-# print "K $key: $$dbh->err{$key}\n";
-# }
-}
-#die "cannot INSERT tool: " . DBI::errstr if ($err && $dbh->err != );
-
$data = $dbh->prepare("SELECT id FROM tool WHERE name = ? AND version = ?") ||
die "cannot fetch tool ID";
$data->execute($tool_name, $tool_ver) || die "cannot fetch tool ID";
@@ -70,7 +57,7 @@
print "$user: $user_id\n";
print "tool ID: $tool_id\n";
-$data = $dbh->prepare("INSERT INTO error(user, error_type, project, " .
+$data = $dbh->prepare("INSERT INTO error_full(user, error_type, project, " .
"project_version, loc_file, loc_line, url) " .
"VALUES (?, ?, ?, ?, ?, ?, ?)") ||
die "cannot prepare INSERT: " . DBI::errstr;
View
6 bug-database/www/bugs.cgi
@@ -14,8 +14,8 @@ my $dbh = DBI->connect("dbi:SQLite:dbname=database.db","","") ||
die "connect to db error: " . DBI::errstr;
my $data;
-my $where = "WHERE error.project_version == ?";
-my @where_param = ("2.6.28");
+my $where = "WHERE 1";
+my @where_param = ();
my $title;
if (defined $cg->param('marking')) {
@@ -76,7 +76,7 @@ $data = $dbh->prepare("SELECT error.id id, error_type.name error_type, " .
"INNER JOIN project ON error.project = project.id " .
"INNER JOIN error_type ON error.error_type = error_type.id " .
"INNER JOIN user ON error.user = user.id " .
- "$where ORDER BY error_type, id") ||
+ "$where ORDER BY error_type, loc_file, loc_line, id") ||
die "cannot SELECT errors: " . DBI::errstr;
$data->execute(@where_param) || die "cannot SELECT errors: " . DBI::errstr;
View
17 bug-database/www/index.cgi
@@ -40,25 +40,22 @@ print $cg->p(qq(This is a database of known bugs and false positives in real ) .
$cg->p($cg->a({href => 'mailto:slaby@fi.muni.cz'}, "Jiri Slaby") . ",",
$cg->a({href => 'mailto:strejcek@fi.muni.cz'}, "Jan Strejcek"),
"and",
- $cg->a({href => 'mailto:trtik@fi.muni.cz'}, "Marek Trtik"));
+ $cg->a({href => 'mailto:trtik@fi.muni.cz'}, "Marek Trtik")),
+ "\n";
print $cg->h2('Errors in the Database'), "\n";
$data = $dbh->prepare("SELECT error_type.*, count(error.id) cid, " .
"(SELECT count(error.id) FROM error WHERE error.marking < 0 AND " .
- "error.error_type == error_type.id AND " .
- "error.project_version == ?) cfp, " .
+ "error.error_type == error_type.id) cfp, " .
"(SELECT count(error.id) FROM error WHERE (error.marking == 0 OR " .
"error.marking IS NULL) AND " .
- "error.error_type == error_type.id AND " .
- "error.project_version == ?) cun, " .
+ "error.error_type == error_type.id) cun, " .
"(SELECT count(error.id) FROM error WHERE error.marking > 0 AND " .
- "error.error_type == error_type.id AND " .
- "error.project_version == ?) crb " .
- "FROM error_type, error WHERE error.error_type==error_type.id AND " .
- "error.project_version == ? " .
+ "error.error_type == error_type.id) crb " .
+ "FROM error_type, error WHERE error.error_type==error_type.id " .
"GROUP BY error_type.name ORDER BY error_type.name") ||
die "cannot SELECT error types: " . DBI::errstr;
-$data->execute("2.6.28", "2.6.28", "2.6.28", "2.6.28") ||
+$data->execute() ||
die "cannot SELECT error types: " . DBI::errstr;
print qq(<table border="1" cellspacing="0">\n);
print qq(<tr style="background-color: #cccccc;">\n);

0 comments on commit 2142a05

Please sign in to comment.