You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "Campbell Boucher-Burnet (JIRA)" <de...@cayenne.apache.org> on 2008/06/07 09:03:52 UTC

[jira] Commented: (CAY-990) HSQLDB: Arithmetic operators in EJBQL

    [ https://issues.apache.org/cayenne/browse/CAY-990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930#action_12930 ] 

Campbell Boucher-Burnet commented on CAY-990:
---------------------------------------------

Try using SQL casts to disambiguate the expression... like:

WHERE  t0.ESTIMATED_PRICE < ( cast(? as decimal) + ( cast(? as decimal) * cast(? as decimal)))

Casting only one of the parameter markers may be enough, as the type of the rest may then be inferred.

However, its been a while sine I was deep in the code.

The point is, it states in the SQL 200n specification that there are definite cases that are to be considered ambiguous, and back in the early 2000s, based on the spec at the time, I wrote much of the 1.7 to early 1.8 HSQLDB expression evaluation code that handled ambiguity under parameter markers, as part of my work refactoring the entire codebase to provide an efficient precompiled parametric statement facility

A for instance in in the ambiguous expression category is an SQL condition likeL "? in (?,?,?,?)"... without explicit casts, at least one term must be resolvable to an SQL literal that has an inferable type in such an expression, for instance  "'test' in (?,?,?,?) " or "? in (?,?,1+4,?)"

What suprises me is that the types of the parameter markers are not inferred automatically in the parse/resolve phase from t0.ESTIMATED_PRICE, which is certainly an ellible, as it is a simple RHS of a relational operator from which to make the inference from the LHS.

Probably, the exception thrown represents a regression caused by ongoing modification's to the source for the expression resolution facility that cause it to fail to adhere to expending the best possible effort toward resolving parameters by inference.


> HSQLDB: Arithmetic operators in EJBQL
> -------------------------------------
>
>                 Key: CAY-990
>                 URL: https://issues.apache.org/cayenne/browse/CAY-990
>             Project: Cayenne
>          Issue Type: Task
>          Components: Cayenne Core Library
>    Affects Versions: 3.0
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.0
>
>
> Implement arithmetic operators in EJBQL.

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