NSString *query = [NSString stringWithFormat:@"select id from Recipes"];
sqlite3_stmt *selectstmt;
if(sqlite3_prepare_v2(database, [query UTF8String], -1, &selectstmt, NULL) == SQLITE_OK) {
while(sqlite3_step(selectstmt) == SQLITE_ROW) {
rcp.recipeID = sqlite3_column_int(selectstmt, 0);
NSString *sql = [NSString stringWithFormat:@"select Name from Ingredients where recipeId = %d",rcp.recipeID];
sqlite3_stmt *stmt2;
if(sqlite3_prepare_v2(database, [sql UTF8String], -1, &stmt2, NULL) == SQLITE_OK) {
while(sqlite3_step(stmt2) == SQLITE_ROW) {}
}
}
}
为什么iOS 5.0出现了这个问题,相同的代码在iOS 4.0、4.2上运行良好?
我知道,我编写的代码是正确的,我想知道在iOS 5.0中出现Sqlite性能问题的确切原因,因为我的应用程序完全基于数据库构建。