metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kasper Sørensen (JIRA) <>
Subject [jira] [Commented] (METAMODEL-135) SQL parsing fails when 'AND' or 'OR' keywords are in caps
Date Sun, 26 Apr 2015 18:30:38 GMT


Kasper Sørensen commented on METAMODEL-135:

This is actually not a bug, but rather a case where the filter items where properly parsed.
The expression-based filter items will only occur when parsing fails. It's as such a "last
resort" for cases where you need (typically in SQL) to allow a user-written filter condition
that is not supported by the query model of MM.

What I do realize is that this is under-documented. We should do something about it, as well
as expression-based SelectItem (which generally work the same way). The only clear indication
of this is currently in the constructor of FilterItem -
- but we should improve also the javadoc of getExpression().

> SQL parsing fails when 'AND' or 'OR' keywords are in caps
> ---------------------------------------------------------
>                 Key: METAMODEL-135
>                 URL:
>             Project: Apache MetaModel
>          Issue Type: Task
>            Reporter: Ashish Mukherjee
> This is what my client code is:
>   DataContext dataContext = new SolrDataContext(url, index);
>   DataSet dataSet = dataContext
>                 .executeQuery("SELECT price FROM collection1 WHERE (((manu = 'Samsung')
AND name = 'hard'))");
> In my SolrDataContext class:
> FilterClause clause = q.getWhereClause();
>         if (clause != null) {
>             List<FilterItem> filterItemList = clause.getItems();
>             boolean isFirst = true;
>             for (FilterItem filterItem : filterItemList) {
>                 String expr = filterItem.getExpression();
>                 System.out.println(expr);
> ....
> expr is null when 'AND' is in caps but gives the correct expression when it is written
as 'and' in the query. Same is true for 'OR' and 'or'. Looks like the parsing is case-sensitive

This message was sent by Atlassian JIRA

View raw message