- (NSArray *) fetchBetriebstelle: (NVGeoStrecke *) strecke { NSMutableArray *resultList = [[NSMutableArray alloc] init]; sqlite3 *database; if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) { NSString *query = [NSString stringWithFormat:@"select IDX,DS100,BTRST_MITTE,LAT,LNG from INF_GEO_STR_BTRST where STR_GKEY = %d order by 1",strecke.key]; const char *sqlStatement = [query UTF8String]; // Setup the SQL Statement sqlite3_stmt *compiledStatement; if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { while(sqlite3_step(compiledStatement) == SQLITE_ROW) { // Read the data from the result row NVGeoStrBetriebsstelle *btrst = [[NVGeoStrBetriebsstelle alloc] init]; btrst.index = sqlite3_column_int(compiledStatement, 0); btrst.name = [NSString stringWithUTF8String: (char *)sqlite3_column_text(compiledStatement, 1)]; btrst.latitude = sqlite3_column_double(compiledStatement, 3); btrst.longitude = sqlite3_column_double(compiledStatement, 4); [resultList addObject:btrst]; [btrst release]; } } sqlite3_finalize(compiledStatement); } sqlite3_close(database); NSArray *result = [NSArray arrayWithArray:resultList]; [resultList release]; return result; }The next job will be to create a MapOverlay in a MKMapView and connect the points to a Path.
Sonntag, 20. Februar 2011
Total Rehash
I have turned to iOS programming and shall posting my notes mainly on this subject.
I'll start out with a little tutorial on reading data from a SQLite Database.
My objective is to read a list of points in a route containing geographical information. This is the Method for reading this data.
Abonnieren
Kommentare zum Post (Atom)
Keine Kommentare:
Kommentar veröffentlichen