开发者

Escape special characters in sqlite

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&am开发者_运维问答p;amp;rl=url';

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

How can I escape these characters?

Please advise.


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


Answered here: Android quotes within an sql query string

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜