Bind NSString to sqlite3 sql statement
Can you guys tell me how to bind a nsstring to a sqlite3 sql statement?
NSString *date = @"test date";
char const *sqlStatement = sqlite3_mprintf("UPDATE facts SET alreadyRead = '%q' WHERE id=%d", date, factId);
%q doesnt work for开发者_JAVA技巧 a string %d works for an nsinteger
Thanks for your help.
NSString *date = @"test date";
char const *sqlStatement = sqlite3_mprintf("UPDATE facts SET alreadyRead = '%q' WHERE id=%d", [date UTF8String], factId);
精彩评论