Escape single quote in JSR query

I have a JSR Query like this, and the value string has single quote in it. I am getting Unexpected token exception as I am not escaping this single quote.

select rx:sys_contentid, rx:sys_revision, rx:displaytitle, jcr:path from rx:XYZContentType where rx:name = ‘Ocean O’ Space’

What is the best way to escape the single quote in JSR queries?

thanks
Manvinder

I’ve never had to do this, but if it’s like normal SQL, you would do it with two single quotes: ‘’

PUtting 2 single quotes do not work for Percussion JSR. Any other way you can think of?

try an _ instead of a ’

the _ should act as a single-character wildcard.

I tried modifying the JSR as follows:

select rx:displaytitle, jcr:path from rx:rffgeneric
where rx:displaytitle=‘About Enterprise _’ Investments’

and it did not worked…Any other ideas???

What he means is:


select rx:sys_contentid, rx:sys_revision, rx:displaytitle, jcrath from rx:XYZContentType where rx:name like 'Ocean O_ Space'

as the _ should match any character (including a '). Notice the “like” as well…

Alternatively, if you pass in the name as a parameter, it should work:


// test is a parameter defined as "Ocean O' Space"
select rx:sys_contentid, rx:sys_revision, rx:displaytitle, jcrath from rx:XYZContentType where rx:name = :test