jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexandru Popescu ☀" <the.mindstorm.mailingl...@gmail.com>
Subject Re: How to escape double quote in SQL term?
Date Mon, 18 Jun 2007 23:26:21 GMT
On 6/18/07, Marcel Reutegger <marcel.reutegger@gmx.net> wrote:
> gsoap wrote:
> > This does not work in case if we search only " see following query:
> you cannot search for the double quote character using the contains function.
> the default tokenizer recognizes the character as noise and ignores it.
> > SELECT * FROM nt:base WHERE CONTAINS(., '""""')
> >
> > In the above query we have a single term and we are searching only " which
> > you say should be replaced by "" but it results in parser exception.
> please note that you don't have to escape the the double quote in a SQL string
> literal. you only have to escape the single quote:
> e.g. if you have the following String literal in your java code:
> String s = "this string contains ' a single quote";
> when you use this string in a SQL contains function you must encode it like this:
> ... where contains(., 'this string contains '' a single quote')
> but here's the important part: double quotes in the string literal of a contains
> function have a special semantic. they mark phrases. e.g. you can search for
> nodes that contain the words apache and jackrabbit as consecutive terms:
> ... where contains(., '"apache jackrabbit"')
> if you have just one double quote or nothing between two double quotes the
> parser will complain that the contains statement is malformed.
> regards
>   marcel

Hi Marcel!

Thanks for the insights. I am wondering where are these bits documented?


.w( the_mindstorm )p.

View raw message