cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Lindesay (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAY-1380) Support for Escaped LIKE Clauses in Expressions
Date Sun, 31 Jan 2010 01:11:34 GMT

    [ https://issues.apache.org/jira/browse/CAY-1380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806771#action_12806771
] 

Andrew Lindesay commented on CAY-1380:
--------------------------------------

Patching-in this feature was more complex than I had initially anticipated.  I have had to
make quite a number of changes and specific changes for the PG and OB adaptors too.  I have
lightly tested this on PG, Oracle and Derby.  There seems to be some sort of problem with
the MySQL driver handling the JDBC database-agnostic {escape ...}.  I had a look at the MySQL
source and the escape handling seems to be there, but I don't have time to fully investigate.
 I presume that as long as I have the architecture right, this anomaly can be investigated
later because this is an augmentation of existing behaviour rather than a change to existing
behaviour.  Again; I am _really_ new to Cayenne architecture so please do check my patch carefully.

> Support for Escaped LIKE Clauses in Expressions
> -----------------------------------------------
>
>                 Key: CAY-1380
>                 URL: https://issues.apache.org/jira/browse/CAY-1380
>             Project: Cayenne
>          Issue Type: New Feature
>    Affects Versions: 3.1M1
>            Reporter: Andrew Lindesay
>         Attachments: CAY1380-patch-31jan2010-1405.diff
>
>
> At present in Cayenne, by using Expressions, it is not possible to escape LIKE clauses.
 So if somebody enters FOO%BAR into a client all you can do is to strip out the %.  This is
a bit tricky to work around.  The JDBC approach is allow you to append some extra text to
the operand in order to define an escape character like this;
> SELECT a FROM tabA WHERE a LIKE '%=_' {escape '='}
> So, I added an instance variable to "PatternMatchNode" to carry the escape char and then
modified "QueryAssemblerHelper" to append this to the operand if it is present.  See attached
patch

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


Mime
View raw message