From b37e43b5ab5a2dda0d50aa1e32b816a799f79bf6 Mon Sep 17 00:00:00 2001 From: "jocuri%softhome.net" <> Date: Sat, 31 Jul 2004 16:36:18 +0000 Subject: Patch for bug 253360: replace IF() with CASE WHEN for database compatibility; patch by Tomas Kopal ; r=vladd, a=justdave. --- process_bug.cgi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'process_bug.cgi') diff --git a/process_bug.cgi b/process_bug.cgi index c0e6e13a6..cdbb69ecf 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -572,9 +572,9 @@ sub ChangeStatus { if ($::FORM{knob} eq 'reopen') { # When reopening, we need to check whether the bug was ever # confirmed or not - $::query .= "bug_status = IF(everconfirmed = 1, " . - SqlQuote($str) . ", " . - SqlQuote($::unconfirmedstate) . ")"; + $::query .= "bug_status = CASE WHEN everconfirmed = 1 THEN " . + SqlQuote($str) . " ELSE " . + SqlQuote($::unconfirmedstate) . " END"; } elsif (IsOpenedState($str)) { # Note that we cannot combine this with the above branch - here we # need to check if bugs.bug_status is open, (since we don't want to @@ -603,11 +603,11 @@ sub ChangeStatus { my @open_state = map(SqlQuote($_), OpenStates()); my $open_state = join(", ", @open_state); - $::query .= "bug_status = IF(bug_status IN($open_state), " . - "IF(everconfirmed = 1, " . - SqlQuote($str) . ", " . - SqlQuote($::unconfirmedstate) . " ), " . - "bug_status)"; + $::query .= "bug_status = CASE WHEN bug_status IN($open_state) THEN " . + "(CASE WHEN everconfirmed = 1 THEN " . + SqlQuote($str) . " ELSE " . + SqlQuote($::unconfirmedstate) . " END) ELSE " . + "bug_status END"; } else { $::query .= "bug_status = " . SqlQuote($str); } -- cgit v1.2.3-24-g4f1b