aboutsummaryrefslogtreecommitdiff
path: root/CGI.pl
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-04-05 04:52:03 +0000
committermkanat%kerio.com <>2005-04-05 04:52:03 +0000
commitf5f31fc070588c2075dd13a0fbabe8117e3aad76 (patch)
tree4a3bb48995143c84fcb8f222b420814e1c6e8eaf /CGI.pl
parentBug 287483: Sanitycheck screams about "Bad value 0 found in components.initia... (diff)
downloadbugzilla-f5f31fc070588c2075dd13a0fbabe8117e3aad76.tar.gz
bugzilla-f5f31fc070588c2075dd13a0fbabe8117e3aad76.tar.bz2
bugzilla-f5f31fc070588c2075dd13a0fbabe8117e3aad76.zip
Bug 286235: Implicit joins should be replaced by explicit joins - installment A
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=joel, a=myk
Diffstat (limited to 'CGI.pl')
-rw-r--r--CGI.pl32
1 files changed, 17 insertions, 15 deletions
diff --git a/CGI.pl b/CGI.pl
index d1c738ff9..f700d3702 100644
--- a/CGI.pl
+++ b/CGI.pl
@@ -176,7 +176,7 @@ sub ValidateBugID {
sub PasswordForLogin {
my ($login) = (@_);
- SendSQL("select cryptpassword from profiles where login_name = " .
+ SendSQL("SELECT cryptpassword FROM profiles WHERE login_name = " .
SqlQuote($login));
my $result = FetchOneColumn();
if (!defined $result) {
@@ -223,8 +223,8 @@ sub CheckIfVotedConfirmed {
PushGlobalSQLState();
SendSQL("SELECT bugs.votes, bugs.bug_status, products.votestoconfirm, " .
" bugs.everconfirmed, NOW() " .
- "FROM bugs, products " .
- "WHERE bugs.bug_id = $id AND products.id = bugs.product_id");
+ "FROM bugs INNER JOIN products ON products.id = bugs.product_id " .
+ "WHERE bugs.bug_id = $id");
my ($votes, $status, $votestoconfirm, $everconfirmed, $timestamp) = (FetchSQLData());
my $sql_timestamp = SqlQuote($timestamp);
my $ret = 0;
@@ -298,7 +298,7 @@ sub GetBugActivity {
die "Invalid id: $id" unless $id=~/^\s*\d+\s*$/;
if (defined $starttime) {
- $datepart = "and bugs_activity.bug_when > " . SqlQuote($starttime);
+ $datepart = "AND bugs_activity.bug_when > " . SqlQuote($starttime);
}
my $suppjoins = "";
my $suppwhere = "";
@@ -309,17 +309,19 @@ sub GetBugActivity {
}
my $query = "
SELECT COALESCE(fielddefs.description, bugs_activity.fieldid),
- fielddefs.name,
- bugs_activity.attach_id, " .
- $dbh->sql_date_format('bugs_activity.bug_when', '%Y.%m.%d %H:%i:%s') .
- ", bugs_activity.removed, bugs_activity.added,
- profiles.login_name
- FROM bugs_activity $suppjoins LEFT JOIN fielddefs ON
- bugs_activity.fieldid = fielddefs.fieldid,
- profiles
- WHERE bugs_activity.bug_id = $id $datepart
- AND profiles.userid = bugs_activity.who $suppwhere
- ORDER BY bugs_activity.bug_when";
+ fielddefs.name, bugs_activity.attach_id, " .
+ $dbh->sql_date_format('bugs_activity.bug_when', '%Y.%m.%d %H:%i:%s') .
+ ", bugs_activity.removed, bugs_activity.added, profiles.login_name
+ FROM bugs_activity
+ $suppjoins
+ LEFT JOIN fielddefs
+ ON bugs_activity.fieldid = fielddefs.fieldid
+ INNER JOIN profiles
+ ON profiles.userid = bugs_activity.who
+ WHERE bugs_activity.bug_id = $id
+ $datepart
+ $suppwhere
+ ORDER BY bugs_activity.bug_when";
SendSQL($query);