0

I have such statement

SELECT _id, _data, title, album, artist, album_id, artist_id, duration, track, _size FROM audio WHERE ( alive=? ) AND (_data LIKE '/storage/sdcard0/Musicc/website'/') ORDER BY title

And i get exception.

android.database.sqlite.SQLiteException: unrecognized token: "') ORDER BY title" (code 1):

It seems to my the problem is that i have symbol "'" in folder name "website'". how can i ignore this symbol?

JenyaKirm
  • 57
  • 1
  • 5

1 Answers1

0

The '/storage/sdcard0/Musicc/website'/' string in your statement has the ' character inside, which is forbidden (how can SQLite know if you meant to put ' in the string, or you meant to end string at that position?). If you want to include ' in the string, escape it by typing '', so your statement would be:

SELECT _id, _data, title, album, artist, album_id, artist_id, duration, track, _size FROM audio WHERE ( alive=? ) AND (_data LIKE '/storage/sdcard0/Musicc/website''/') ORDER BY title
Googie
  • 5,742
  • 2
  • 19
  • 31