我有我在其中存儲源地址,目標地址和類別的數據庫。現在我只想在表格視圖中顯示存儲在該數據庫中的最後10個數據。我使用的檢索數據表格數據庫,這個代碼...如何在數據庫中顯示存儲在表視圖中的最後10個數據?
-(void) openDB {
listOfStudents = [[NSMutableArray alloc] init];
if(sqlite3_open([databasePath UTF8String], &db) == SQLITE_OK) {
const char *sql = "select * from Places";
sqlite3_stmt *stmt;
int rtnVal = sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
if(rtnVal == SQLITE_OK) {
while (sqlite3_step(stmt) == SQLITE_ROW) {
Places_data *pd_object = [[[Places_data alloc] init] autorelease];
pd_object.place_id = sqlite3_column_int(stmt, 0);
pd_object.start_add = [NSString stringWithUTF8String:(char *) sqlite3_column_text(stmt, 1)];
pd_object.end_add = [NSString stringWithUTF8String:(char *) sqlite3_column_text(stmt, 2)];
pd_object.strcategroy = [NSString stringWithUTF8String:(char *) sqlite3_column_text(stmt, 3)];
[self.listOfStudents addObject:pd_object];
}
}
sqlite3_finalize(stmt);
}
sqlite3_close(db);
}
現在我做什麼,在上面的代碼中顯示的變化,它僅顯示過去10個結果表視圖?