1

I am trying to update a SQLite table in my Android application. Predicate for this update is built around a column which stores different resource URLs.

These URLs might contain special characters such as /~?=; (and even &).

My query looks like:

update TableName where columnVal = '/some/fake/~/id?u=0&rl=url';

The update query doesnt work; it does not identify the column satifying the condition.

How can I escape these characters?

Please advise.

Samuh
  • 36,316
  • 26
  • 109
  • 116

2 Answers2

5

You should be using the method update instead of generating the SQL yourself. The built-in methods will do all the needed escaping for you.

http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html

RoToRa
  • 37,635
  • 12
  • 69
  • 105
  • 3
    I don't mean to be a douchebag, but this is not really an answer to the OP's question, though, is it? :) – Lukas1 Feb 11 '14 at 09:56
2

Answered here: Android quotes within an sql query string

Community
  • 1
  • 1
Fredrik Leijon
  • 2,792
  • 18
  • 20