openPilotLog
tablecolumnliterals.h
1 #ifndef TABLECOLUMNLITERALS_H
2 #define TABLECOLUMNLITERALS_H
3 
4 #include <QString>
5 #include <QStringLiteral>
6 
7 // [F]: These constants deviate slightly from const naming convention to reflect their sql column name.
8 // In many places throughout the application, we have to programatically access or write data
9 // to or from the database using column names as identifiers, doing something like this:
10 //
11 // newData.insert("dept", ui->deptLocLineEdit->text());
12 // newData.value("multipilot") // do stuff
13 //
14 //
15 // Declaring the literals here avoids memory allocation at runtime for construction of temporary qstrings
16 // like ("dept"). See https://doc.qt.io/qt-5/qstring.html#QStringLiteral
17 //
18 
19 // Table names
20 static const auto DB_TABLE_FLIGHTS = QStringLiteral("flights");
21 static const auto DB_TABLE_PILOTS = QStringLiteral("pilots");
22 static const auto DB_TABLE_TAILS = QStringLiteral("tails");
23 static const auto DB_TABLE_AIRCRAFT = QStringLiteral("aircraft");
24 static const auto DB_TABLE_AIRPORTS = QStringLiteral("airports");
25 
26 // Flights table
27 static const auto DB_FLIGHTS_DOFT = QStringLiteral("doft");
28 static const auto DB_FLIGHTS_DEPT = QStringLiteral("dept");
29 static const auto DB_FLIGHTS_DEST = QStringLiteral("dest");
30 static const auto DB_FLIGHTS_TOFB = QStringLiteral("tofb");
31 static const auto DB_FLIGHTS_TONB = QStringLiteral("tonb");
32 static const auto DB_FLIGHTS_PIC = QStringLiteral("pic");
33 static const auto DB_FLIGHTS_ACFT = QStringLiteral("acft");
34 static const auto DB_FLIGHTS_TBLK = QStringLiteral("tblk");
35 static const auto DB_FLIGHTS_TSPSE = QStringLiteral("tSPSE");
36 static const auto DB_FLIGHTS_SPME = QStringLiteral("tSPME");
37 static const auto DB_FLIGHTS_TMP = QStringLiteral("tMP");
38 static const auto DB_FLIGHTS_TNIGHT = QStringLiteral("tNIGHT");
39 static const auto DB_FLIGHTS_TIFR = QStringLiteral("tIFR");
40 static const auto DB_FLIGHTS_TPIC = QStringLiteral("tPIC");
41 static const auto DB_FLIGHTS_TPICUS = QStringLiteral("tPICUS");
42 static const auto DB_FLIGHTS_TSIC = QStringLiteral("tSIC");
43 static const auto DB_FLIGHTS_TDUAL = QStringLiteral("tDUAL");
44 static const auto DB_FLIGHTS_TFI = QStringLiteral("tFI");
45 static const auto DB_FLIGHTS_TSIM = QStringLiteral("tSIM");
46 static const auto DB_FLIGHTS_PILOTFLYING = QStringLiteral("pilotFlying");
47 static const auto DB_FLIGHTS_TODAY = QStringLiteral("toDay");
48 static const auto DB_FLIGHTS_TONIGHT = QStringLiteral("toNight");
49 static const auto DB_FLIGHTS_LDGDAY = QStringLiteral("ldgDay");
50 static const auto DB_FLIGHTS_LDGNIGHT = QStringLiteral("ldgNight");
51 static const auto DB_FLIGHTS_AUTOLAND = QStringLiteral("autoland");
52 static const auto DB_FLIGHTS_SECONDPILOT = QStringLiteral("secondPilot");
53 static const auto DB_FLIGHTS_THIRDPILOT = QStringLiteral("thirdPilot");
54 static const auto DB_FLIGHTS_APPROACHTYPE = QStringLiteral("approachType");
55 static const auto DB_FLIGHTS_FLIGHTNUMBER = QStringLiteral("flightNumber");
56 static const auto DB_FLIGHTS_REMARKS = QStringLiteral("remarks");
57 
58 // tails table
59 
60 static const auto DB_TAILS_REGISTRATION = QStringLiteral("registration");
61 static const auto DB_TAILS_COMPANY = QStringLiteral("company");
62 static const auto DB_TAILS_MAKE = QStringLiteral("make");
63 static const auto DB_TAILS_MODEL = QStringLiteral("model");
64 static const auto DB_TAILS_VARIANT = QStringLiteral("variant");
65 static const auto DB_TAILS_MULTIPILOT = QStringLiteral("multipilot");
66 static const auto DB_TAILS_MULTIENGINE = QStringLiteral("multiengine");
67 static const auto DB_TAILS_ENGINETYPE = QStringLiteral("engineType");
68 static const auto DB_TAILS_WEIGHTCLASS = QStringLiteral("weightClass");
69 
70 // pilots table
71 
72 static const auto DB_PILOTS_LASTNAME = QStringLiteral("lastname");
73 static const auto DB_PILOTS_FIRSTNAME = QStringLiteral("firstname");
74 static const auto DB_PILOTS_ALIAS = QStringLiteral("alias");
75 static const auto DB_PILOTS_COMPANY = QStringLiteral("company");
76 static const auto DB_PILOTS_EMPLOYEEID = QStringLiteral("employeeid");
77 static const auto DB_PILOTS_PHONE = QStringLiteral("phone");
78 static const auto DB_PILOTS_EMAIL = QStringLiteral("email");
79 
80 // all tables
81 
82 static const auto DB_ROWID = QStringLiteral("ROWID");
83 static const auto DB_NULL = QStringLiteral("");
84 static const auto DB_NULL_hhmm = QStringLiteral("00:00");
85 /*static const auto DB_ = QStringLiteral("");
86 static const auto DB_ = QStringLiteral("");
87 static const auto DB_ = QStringLiteral("");
88 static const auto DB_ = QStringLiteral("");
89 static const auto DB_ = QStringLiteral("");*/
90 
91 #endif // TABLECOLUMNLITERALS_H