IF() should be replaced by CASE WHEN

RESOLVED FIXED in Bugzilla 2.20

Status

()

RESOLVED FIXED
15 years ago
5 years ago

People

(Reporter: Tomas.Kopal, Assigned: Tomas.Kopal)

Tracking

(Blocks: 1 bug)

unspecified
Bugzilla 2.20
Dependency tree / graph
Bug Flags:
approval +

Details

Attachments

(1 attachment)

(Assignee)

Description

15 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.1) Gecko/20040721 Debian/1.7.1-2
Build Identifier: 

As IF(cond, exp1, exp2) function is MySQL specific, we should replace it with
CASE WHEN cond THEN exp1 ELSE exp2 END, which is supported by all major
databases (see bug 182136).
The patch will follow

Reproducible: Always
Steps to Reproduce:
Since when does MySQL support it?
(Assignee)

Comment 2

15 years ago
Created attachment 154536 [details] [diff] [review]
Patch replacing IF() with CASE WHEN
(Assignee)

Updated

15 years ago
Attachment #154536 - Flags: review?
(Assignee)

Updated

15 years ago
Blocks: 98304, 173130, 189947
(Assignee)

Comment 3

15 years ago
"CASE was added in MySQL 3.23.3"  (see
http://dev.mysql.com/doc/mysql/en/Control_flow_functions.html). I think we
currently require 3.23.3 or higher, right?
yeah, just found that in the changelog myself before coming back here.  How
interesting.

Yes, we currently require 3.23.41 or newer, so that shouldn't be a problem at all.

(Although I do think IF() is easier to read, but compatibility rules...)
Status: UNCONFIRMED → NEW
Ever confirmed: true

Updated

15 years ago
Attachment #154536 - Flags: review? → review+

Updated

15 years ago
Assignee: justdave → Tomas.Kopal
Flags: approval?
Target Milestone: --- → Bugzilla 2.20
Flags: approval? → approval+

Comment 5

15 years ago
Checking in editgroups.cgi;
/cvsroot/mozilla/webtools/bugzilla/editgroups.cgi,v  <--  editgroups.cgi
new revision: 1.41; previous revision: 1.40
done
Checking in editusers.cgi;
/cvsroot/mozilla/webtools/bugzilla/editusers.cgi,v  <--  editusers.cgi
new revision: 1.68; previous revision: 1.67
done
Checking in process_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v  <--  process_bug.cgi
new revision: 1.211; previous revision: 1.210
done
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.