我正在使用SQLITE
我的 iPhone 应用程序。在中插入值后detailedViewController
,我正在masterViewController viewWillAppear
方法中重新加载数据库中的数据。但是,除非我重新启动应用程序,否则我无法在那里获得新更新的行。我正在完成编译的语句并在INSERT
.
sqlite3_finalize(compiledStatement);
sqlite3_close(database);
关于我可能做错了什么的任何指示?
if(sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK) {
const char *sqlStatement = "SELECT * FROM MYCAR1";
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
//...getting data from compiled statements...
MyCar *car=[[MyCar alloc] initWithVIN:vin.intValue andMake:make andModel:model andYear:year andColor:color andImageData:image];
[myArray addObject:car];
}
}
sqlite3_finalize(compiledStatement);
carList=myArray;
}
sqlite3_close(database);
[self.tableView reloadData];