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

Andy Jefferson commented on JDO-650:
------------------------------------

Further things on that test.
1. main(String[] args) is calling the wrong class.
2. expectedResult should have the same number of results as positive tests. It 
currently has one.

The second positive test is unlikely to work on all RDBMS. I tried the 
following query on Derby

SELECT * FROM DATASTOREIDENTITY0.PERSONS A0 
LEFT OUTER JOIN DATASTOREIDENTITY0.DEPARTMENTS B0 ON A0.DEPARTMENT = 
B0.DATASTORE_IDENTITY 
WHERE A0.DISCRIMINATOR = 'org.apache.jdo.tck.pc.company.FullTimeEmployee' 
AND (CASE WHEN B0."NAME" = 'Development' THEN A0.SALARY > 15000 ELSE A0.SALARY 
> 25000 END)

and it gives an exception
java.sql.SQLSyntaxErrorException: Syntax error: Encountered ">" at line 1, 
column 412.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source)
    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
    at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
    at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
Source)
    at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown 
Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown 
Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown 
Source)
    at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown 
Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown 
Source)

Namely Derby seemingly does not support use of arithmetic ops within a case 
(scalar expression) clause. Suggest that the tests be restricted to having 
simple scalar expressions in the CASE.

> 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, tck
>    Affects Versions: JDO 2 maintenance release 2 (2.2)
>            Reporter: Michael Bouschen
>            Assignee: Michael Bouschen
>             Fix For: JDO 3.1
>
>
> JDOQL should support the Java conditional operator ? :, e.g. salary >= 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 was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to