Edgewall Software

Changes between Initial Version and Version 1 of Ticket #5840


Ignore:
Timestamp:
Aug 9, 2007, 8:24:31 AM (17 years ago)
Author:
Noah Kantrowitz
Comment:

It is worth noting that after some standards digging, I found that SELECT ... ORDER BY ... is not actually in any standard, though moving to this CASE based query is closer to the standard at least.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5840 – Description

    initial v1  
    1 The syntax used in ORDER BY in the view ticket queries is not transportable to all DBMSs.
     1The syntax used in `ORDER BY` in the view ticket queries is not transportable to all DBMSs.
    22
    3 I propose to use a CASE WHEN clause instead of ORDER BY (status = 'assigned) -> ORDER BY (CASE WHEN status = 'assigned' THEN 1 ELSE 2 END) DESC
     3I propose to use a `CASE WHEN` clause instead of `ORDER BY (status = 'assigned')` -> `ORDER BY (CASE WHEN status = 'assigned' THEN 1 ELSE 2 END) DESC`
    44
    55Here's a snippet for the new get_reports:
    6 
     6{{{
     7#!python
    78def get_reports(db):
    89    owner = db.concat('owner', "' *'")
     
    167168  ORDER BY (CASE WHEN owner = $USER THEN 1 ELSE 2 END), p.value, milestone, t.type, time
    168169""" % owner))
     170}}}