Commit 184130db authored by jocuri%softhome.net's avatar jocuri%softhome.net

Patch for bug 249798: improve SQL capitalization in sanitycheck.cgi; r=joel, a=justdave.

parent 207f5584
...@@ -97,18 +97,18 @@ PutHeader("Bugzilla Sanity Check"); ...@@ -97,18 +97,18 @@ PutHeader("Bugzilla Sanity Check");
if (defined $cgi->param('rebuildvotecache')) { if (defined $cgi->param('rebuildvotecache')) {
Status("OK, now rebuilding vote cache."); Status("OK, now rebuilding vote cache.");
SendSQL("lock tables bugs write, votes read"); SendSQL("LOCK TABLES bugs WRITE, votes READ");
SendSQL("update bugs set votes = 0, delta_ts=delta_ts"); SendSQL("UPDATE bugs SET votes = 0, delta_ts = delta_ts");
SendSQL("select bug_id, sum(vote_count) from votes group by bug_id"); SendSQL("SELECT bug_id, SUM(vote_count) FROM votes GROUP BY bug_id");
my %votes; my %votes;
while (@row = FetchSQLData()) { while (@row = FetchSQLData()) {
my ($id, $v) = (@row); my ($id, $v) = (@row);
$votes{$id} = $v; $votes{$id} = $v;
} }
foreach my $id (keys %votes) { foreach my $id (keys %votes) {
SendSQL("update bugs set votes = $votes{$id}, delta_ts=delta_ts where bug_id = $id"); SendSQL("UPDATE bugs SET votes = $votes{$id}, delta_ts = delta_ts WHERE bug_id = $id");
} }
SendSQL("unlock tables"); SendSQL("UNLOCK TABLES");
Status("Vote cache has been rebuilt."); Status("Vote cache has been rebuilt.");
} }
...@@ -436,7 +436,7 @@ sub AlertBadVoteCache { ...@@ -436,7 +436,7 @@ sub AlertBadVoteCache {
$offervotecacherebuild = 1; $offervotecacherebuild = 1;
} }
SendSQL("SELECT bug_id,votes,keywords FROM bugs " . SendSQL("SELECT bug_id, votes, keywords FROM bugs " .
"WHERE votes != 0 OR keywords != ''"); "WHERE votes != 0 OR keywords != ''");
my %votes; my %votes;
...@@ -454,7 +454,7 @@ while (@row = FetchSQLData()) { ...@@ -454,7 +454,7 @@ while (@row = FetchSQLData()) {
} }
Status("Checking cached vote counts"); Status("Checking cached vote counts");
SendSQL("select bug_id, sum(vote_count) from votes group by bug_id"); SendSQL("SELECT bug_id, SUM(vote_count) FROM votes GROUP BY bug_id");
while (@row = FetchSQLData()) { while (@row = FetchSQLData()) {
my ($id, $v) = (@row); my ($id, $v) = (@row);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment