You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Li Zhou <lz...@smausa.com> on 2011/01/19 00:03:32 UTC
likeIgnoreCaseDbExp syntax error in 3.0.1
Hi, All
I am encountering an issue with below Expression method in Cayenne 3.0.1
stable version.
likeIgnoreCaseDbExp(String pathSpec, Object value, char escapeChar)
A convenience shortcut for building LIKE_IGNORE_CASE expression.
The error message is below.
SELECT * FROM TEST_TABLE t0 WHERE UPPER(t0.NAME) LIKE UPPER(? {escape '*'})
[bind: 1->NAME:'A*_1']
java.sql.SQLException: *Incorrect syntax near the keyword 'escape'.*
at
net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
at
net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477)
at
net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:776)
at
org.apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.java:71)
at
org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:87)
at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:269)
at
org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:422)
at
org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:69)
at
org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:395)
at
org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
at
org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:392)
at
org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:121)
at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:743)
at
org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:333)
at
org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1278)
at
org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1267)
If I am not mistaken, the parenthesis position in the generated SQL query
is not right. It should be put near the question mark instead of the last
position like below:
SELECT * FROM TEST_TABLE t0 WHERE UPPER(t0.NAME) LIKE UPPER(?) {escape '*'}
The question mark binding value is 'A*_1'
Did any one encounter the same issue ?
Thanks,
Li
Re: likeIgnoreCaseDbExp syntax error in 3.0.1
Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Li,
Looks like a bug to me. Could you please open a bug report in Jira ( https://issues.apache.org/jira/browse/CAY ), providing the information below, and maybe also a specific piece of Java code that causes this error.
Thanks,
Andrus
On Jan 19, 2011, at 1:03 AM, Li Zhou wrote:
> Hi, All
> I am encountering an issue with below Expression method in Cayenne 3.0.1
> stable version.
>
> likeIgnoreCaseDbExp(String pathSpec, Object value, char escapeChar)
> A convenience shortcut for building LIKE_IGNORE_CASE expression.
>
> The error message is below.
>
> SELECT * FROM TEST_TABLE t0 WHERE UPPER(t0.NAME) LIKE UPPER(? {escape '*'})
> [bind: 1->NAME:'A*_1']
>
> java.sql.SQLException: *Incorrect syntax near the keyword 'escape'.*
> at
> net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
> at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
> at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
> at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
> at
> net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477)
> at
> net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:776)
> at
> org.apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.java:71)
> at
> org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:87)
> at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:269)
> at
> org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:422)
> at
> org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:69)
> at
> org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:395)
> at
> org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
> at
> org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:392)
> at
> org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:121)
> at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:743)
> at
> org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:333)
> at
> org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
> at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1278)
> at
> org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1267)
>
>
> If I am not mistaken, the parenthesis position in the generated SQL query
> is not right. It should be put near the question mark instead of the last
> position like below:
>
> SELECT * FROM TEST_TABLE t0 WHERE UPPER(t0.NAME) LIKE UPPER(?) {escape '*'}
> The question mark binding value is 'A*_1'
>
>
> Did any one encounter the same issue ?
>
> Thanks,
>
> Li