你们能告诉我如何将nsstring绑定到sqlite3 sql语句吗?
NSString *date = @"test date";
char const *sqlStatement = sqlite3_mprintf("UPDATE facts SET alreadyRead = '%q' WHERE id=%d", date, factId);
%q不适用于字符串 %d适用于nsinteger
感谢您的帮助。
答案 0 :(得分:0)
NSString *date = @"test date";
char const *sqlStatement = sqlite3_mprintf("UPDATE facts SET alreadyRead = '%q' WHERE id=%d", [date UTF8String], factId);