On 19 Sep 2012, at 17:47, Martin Spott wrote: > Hi James, nice feature - I like storing this sort of stuff in > structured databases :-) > > There's one item looking a little bit strange to me: Apparently the > "positioned" table has a numeric identifier "airport" to refer runways > and taxiways to their respective airport. This seems to be a simple > sequence - but the records containing the airport name and ident > (type = 1) are always having airport = 0.
Not just runways or taxiways - also marker beacons, ILSs, towers, comm frequencies and anything else that might be located at the airport. It's the sqlite rowID of the airport record - both in the positioned table, but also the 'airports' table. For all the secondary tables which extend 'positioned', the rowids are the join key. Sqlite rowIds are 64 bit unsigned values, and that's *also* the PositionedID values you will see in the code in several places now. > The entire schema is probably going to work as expected as long as the > ordering in the "positioned" table remains unchanged (this looks to me > being mostly a verbatim adaption of the "apt.dat" plus a few custom > additions), but I don't understand how you manage to group runways and > taxiways together with their airport if the ordering gets confused. There's no ordering dependency - when I see the first airport line, I add the row to positioned, and that generates the new row ID. That's then stored by the airport-loader, and passed when inserting rows for all other things located at the airport. The grouping is then something like 'select from positioned where type=blah and airport=airportID'. You could do a positioned-positioned join to select directly by ICAO, but I'm trying (and have managed!) to avoid any JOINs apart from when creating the cache, i.e very rarely. All the runtime queries should be a single table, and on an indexed column. James ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel