"IN" expression binding multiple values
I want to migrate user data from old SQLite to new SQLite.
First, I query the id of all favorite content via
SELECT id FROM content WHERE favorite = 1
Then I kept all favorite content id in NSMutableArray like this
NSMutableArray *favContentIds = [NSMutableArray array];
while (sqlite3_step(compiledStatement) == SQLITE_ROW) {
NSInteger favContentId = sqlite3_column_int(compiledStatement, 0);
[favContentIds addObject:[NSNumber numberWithInteger:favContentId]];
}
Now I want to bind favContentIds in update statement
UPDATE content SET favorite = 1 WHERE id IN ?
开发者_开发知识库
I tried sqlite3_bind_text but it doesn't work. Do I have to convert favContentIds to NSString with UTF8String?
Any help would be appreciated.
精彩评论