How can i use php real_escape_string i开发者_如何转开发n android sqlite?
when i add the following to my table row's value "asd'" then i getting a crash because of "'" char. How can I escape illegal characters in android sqlite?
Thanks
edit: in android, not php
I think an equivalent function is DatabaseUtils.sqlEscapeString(stringToEscape)
. (Javadoc: SQL_escape a string).
If you are using the SQLiteDatabase insert
method taking a ContentValues
as a parameter, these may be automatically escaped for you, but I'm not 100% (and I haven't been able to check).
精彩评论