AirNav RadarBox
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 


Author Topic: NavData  (Read 1575 times)

0 Members and 1 Guest are viewing this topic.

RodBearden

  • Hero Member
  • *****
  • Posts: 9124
    • Rod's RadarBox Downloads
NavData
« on: July 04, 2009, 02:06:32 PM »
Chris recently suggested that the IATA code be made the primary key in the Airlines table, and I think it would be a good idea, but does it actually matter? It does seem to tolerate duplicate ICAO codes anyway.

Also, will this change be possible without having to replace our current NavData files?

Another thing - nobody gave me an answer on the main forum about what the BY condition does. If nobody uses it, can't we get rid of it, or at least make IN the default, and avoid a couple of clicks for every database query that we do?

Rod
Rod

tarbat

  • ShipTrax Beta Testers
  • Hero Member
  • *
  • Posts: 4219
    • Radarbox at Easter Ross
Re: NavData
« Reply #1 on: July 04, 2009, 02:19:33 PM »
If the only thing the Airlines table is used for is to do lookups to derive airline logos, then I'd recommend we change the primary key to C2 (the IATA code).

Change should be possible in the installer, or at first-run of the new v3 app.  Using SQL like this:

CREATE TEMPORARY TABLE airlines01(
  CN,
  C3,
  CM,
  C2
);

INSERT INTO airlines01
SELECT
  CN,
  C3,
  CM,
  C2
FROM airlines;

DROP TABLE airlines;

CREATE TABLE airlines (
  CN  varchar(80),
  C3  varchar(6),
  CM  varchar(6),
  C2  varchar(6) PRIMARY KEY NOT NULL UNIQUE
);

CREATE INDEX iC2
  ON airlines
  (C2);

CREATE INDEX iC3
  ON airlines
  (C3);

INSERT INTO airlines
SELECT
  CN,
  C3,
  CM,
  C2
FROM airlines01;

DROP TABLE airlines01;

AirNav Development

  • AirNav Systems
  • Hero Member
  • *****
  • Posts: 2545
    • AirNav Systems
Re: NavData
« Reply #2 on: July 04, 2009, 02:19:50 PM »
Copied. Pls post more suggestions.