db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timo Westkämper (JIRA) <j...@apache.org>
Subject [jira] Commented: (JDO-650) Support for conditional operator ? : in JDOQL
Date Fri, 04 Dec 2009 08:11:20 GMT

    [ https://issues.apache.org/jira/browse/JDO-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785812#action_12785812
] 

Timo Westkämper commented on JDO-650:
-------------------------------------

The proposed syntax gets a bit tricky with longer expressions

case
  when salary < 100 then "bronze"
  when salary < 1000 then "silver"
  when salary < 10000 then "gold"
  else "platinum"
end

becomes

salary < 100 ? "bronze" : ( salary < 1000 ? "silver" : ( salary < 10000 ? "gold"
: "platinum" )) 

Querydsl uses the case-when-else-end form.

> Support for conditional operator ? : in JDOQL
> ---------------------------------------------
>
>                 Key: JDO-650
>                 URL: https://issues.apache.org/jira/browse/JDO-650
>             Project: JDO
>          Issue Type: New Feature
>          Components: specification, tck2
>    Affects Versions: JDO 2 maintenance release 2
>            Reporter: Michael Bouschen
>            Assignee: Michael Bouschen
>
> JDOQL should support the Java conditional operator ? :, e.g. salay >= 1000.0 ? salary
: salary * 1.1
> The conditional operator can be mapped to the CASE-expression in SQL: CASE WHEN condition
THEN thenExpr ELSE elseExpr END. Are there any issues with non-SQL datastores when supporting
the conditional operator? 
> Another question: which part of a JDOQL query can include a conditional expression? I
propose the query filter, the having clause and the result specification.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message