2

I'm trying to figure out how to escape a single quote for a query of a Usergrid collection. I can't find anything about it in the documentation or online. For example I have a Book collection and I want to select those with the title "Charolette's Web"

/books/?ql=select*where title = 'Charlotte\'s Web'

This query does not give back any results from the database query. I also tried '' as the escape character (like sql) but that didn't work either.

brandonscript
  • 68,675
  • 32
  • 163
  • 220
jeremylach
  • 75
  • 7

1 Answers1

1

As far as I know, there's no way to escape quotes in a ql request at the current time.

You could work around this by using a contains clause:

?ql=select * where title contains 'Charlotte'

I've opened an issue for it to be looked at here.

brandonscript
  • 68,675
  • 32
  • 163
  • 220
  • This is based on a user input though. If they enter "Charlotte's Web" I'm having trouble getting the correct entry to be retrieved – jeremylach Sep 29 '15 at 03:23
  • Right - contains will still return the entity; you'll just have to do a filter check on it afterward. Of course this also assumes you know the name you're querying for. – brandonscript Sep 29 '15 at 03:39