I am using the sqlite3.0 library with xcode and I'm having trouble deleting rows from my database. I am using a tableview to generate my DELETE sql query and calling another method to execute it. However, the code is not being run in the if block where i test "test". test evaluates to and int value of 1, which is listed as " /* SQL error or missing database */ " in the definition in the sqllite API code.
I am not sure how to debug this one as I am unsure of how the API truly works under the hood. it seems that the arguments to the C function are all valid. the query looks fine in the debugger, the null, null, &error are all standard from what i've seen online. And I am not sure how passing the personDB, which is a "sqlite3" type object as an instance variable in my tableviewcontroller class.
anyone with this sqlite API experience who can point me in the right direction?
-(void)deleteData:(NSString *)deleteQuery
{
char *error;
int test = sqlite3_exec(personDB, [deleteQuery UTF8String], NULL, NULL, &error);
if (test==SQLITE_OK)
{
NSLog(@"Person Deleted");
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Delete" message:@"Person Deleted" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:nil];
[alert show];
}
}
Aucun commentaire:
Enregistrer un commentaire