You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Wickersheimer Jeremy (JIRA)" <ji...@apache.org> on 2009/03/09 19:23:50 UTC

[jira] Updated: (OFBIZ-1266) EntityOperator.IN will crash on some databases with empty list

     [ https://issues.apache.org/jira/browse/OFBIZ-1266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wickersheimer Jeremy updated OFBIZ-1266:
----------------------------------------

    Attachment: 1266.patch

Patch that replaces WHERE FALSE condition to WHERE 1=0

> EntityOperator.IN will crash on some databases with empty list
> --------------------------------------------------------------
>
>                 Key: OFBIZ-1266
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1266
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: derby, unkown other databases
>            Reporter: Leon Torres
>            Assignee: Adam Heath
>         Attachments: 1266.patch
>
>
> If you use the following entity exr,
>    new EntityExpr("orderId", EntityOperator.IN, new ArrayList());
> It will crash on at least Derby.  The reason is that this condition evaluates to the keyword FALSE, which apparently is not supported on Derby.  The problem code is in EntityComparisonOperator.java:
>         // if this is an IN operator and the rhs Object isEmpty, add "FALSE" instead of the normal SQL
>         if (this.idInt == EntityOperator.ID_IN && UtilValidate.isEmpty(rhs)) {
>             sql.append("FALSE");
>             return;
>         }
> Perhaps this is over engineered?  What happens if we just leave this out and let it generate an "IN ()" SQL?

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