iphone sqlite quotes problem
I have a problem with a following sqlite query:
sql = [NSString stringWithFormat:@"Insert into table_name(height)values('%@')",heightarray];
I am getting heightarray
from XML, the value of heightarray
is:
array = ( "5'0\"-5'3\"",
"5'4\"-5'8\"",
"5'9开发者_StackOverflow\"-6'0\"" )
The \" is added implicitly for some reason, I don't know why?
It is causing problem. please help.
try to use
sql = [NSString stringWithFormat:@"Insert into table_name(height)values(?)"];
and then use
sqlite3_bind_text
If you're using sqlite try this wrapper it helps a lot https://github.com/ccgus/fmdb
There are detailed examples how to use it.
精彩评论