- (void)loadNamesFromDatabase
{
NSString *file = [[NSBundle mainBundle] pathForResource:@"records" ofType:@"db"];
sqlite3 *database = NULL;
if (sqlite3_open([file UTF8String], &database) == SQLITE_OK) {
sqlite3_exec(database, "SELECT game FROM records", MyCallback, records, NULL);
}
sqlite3_close(database);
}
- (IBAction)addNewRecord:(id)sender{
NSLog(@"addnew");
[self insertNew];
}
-(void)insertNew{
NSString *file = [[NSBundle mainBundle] pathForResource:@"records" ofType:@"db"];
sqlite3 *database = NULL;
if (sqlite3_open([file UTF8String], &database) == SQLITE_OK) {
sqlite3_exec(database, "insert into records (game, number, time) values (0,1,50)", MyCallback, records, NULL);
}
sqlite3_close(database);
}