Possible Duplicate:
What's the best way to delete all data from a table?
Clear all items from a table in Sqlite3 IPHONE? supported? DROP TABLE? DELETE FROM TABLA_1?
- (void) DeleteDataSqlite3 {
NSLog(@"Borra data");
const char *dbpath = [databasePath UTF8String];
sqlite3_stmt *statement;
NSString *querySQL = @"DELETE FROM EVENTOS";
const char *query_stmt = [querySQL UTF8String];
//Open d
if (sqlite3_open(dbpath, &eventosDB) == SQLITE_OK){
if (sqlite3_prepare_v2(eventosDB, query_stmt, -1, &statement, NULL) == SQLITE_OK){
NSLog(@"oK");
}else {
NSLog(@"Error !query");
}
}else {
NSLog(@"Open error");
}
sqlite3_close(eventosDB);
}
Thanks!!!
Most modern databases including SQLite support rapid mass deletes. In practice there is not much to gain from dropping the table instead.