I want to delete from usergroup table where userId = 4 and groupId = 5. How do I fix this delete with multiple where?
NSString* query = [NSString stringWithFormat:@"DELETE FROM %@ where %@ = ? AND %@ = ?);",USER_GROUPS_TABLE,USER_ID,GROUP_ID];
if (sqlite3_prepare_v2(database,[query UTF8String],-1,&statment,nil) == SQLITE_OK){
sqlite3_bind_text(statment, 1, [userId UTF8String],-1,NULL);
sqlite3_bind_text(statment, 2, [groupId UTF8String],-1,NULL);
if(sqlite3_step(statment) == SQLITE_DONE){
NSLog(@"removeRow done");
sqlite3_finalize(statment);
return;
}
}
Aucun commentaire:
Enregistrer un commentaire