can anybody tell How to escape or replace not supported character like single quotes in sqlite in android can anybody give example
Thanks
Actually, the simpliest way is to replace single quotes (') with two-single quotes (''). Your query will then become:
insert into tname(foo) values ('one''s self');
Explanation: SQLite advocates the use of single quotes (') instead of double quotes (") as string delimiters, claiming that this is what the SQL standard requires (I was unable to confirm this). SQLite also differs from all other SQL databases I know, in that it uses '' instead of \' , again, claiming SQL standards. (Again, I was unable to confirm this claim).
Personally, I tend to disagree with that claim, since every other SQL database I know uses the C way of escaping chars, backslash. Even if it was written to use '' somewhere in ISO's SQL standard, I believe it might be best to revise that standard to use the C way, because in practice, it already is the standard anyway.
Please note that:
insert into tname(foo) values ('ones "self"');
is a valid sql statement by that logic, and requires no additional escaping.