|
@@ -31,7 +31,7 @@
|
|
|
#include <QSqlRecord>
|
|
|
#include <QSqlField>
|
|
|
|
|
|
-#include "src/database/declarations.h"
|
|
|
+#include "src/database/adatabasetypes.h"
|
|
|
#include "src/classes/aentry.h"
|
|
|
#include "src/classes/apilotentry.h"
|
|
|
#include "src/classes/atailentry.h"
|
|
@@ -89,33 +89,20 @@ public:
|
|
|
class ADatabase : public QObject {
|
|
|
Q_OBJECT
|
|
|
public:
|
|
|
- using RowId_t = int;
|
|
|
-
|
|
|
- using PilotName_t = QString;
|
|
|
- using PilotRowId_t = RowId_t;
|
|
|
-
|
|
|
- using TailRgstr_t = QString;
|
|
|
- using TailId_t = RowId_t;
|
|
|
-
|
|
|
- using ArprtICAO_t = QString;
|
|
|
- using ArprtIATA_t = QString;
|
|
|
- using ArprtName_t = QString;
|
|
|
- using ArprtId_t = RowId_t;
|
|
|
-
|
|
|
|
|
|
private:
|
|
|
ADatabase();
|
|
|
|
|
|
static ADatabase* self;
|
|
|
- TableNames tableNames;
|
|
|
- TableColumns tableColumns;
|
|
|
+ TableNames_t tableNames;
|
|
|
+ TableColumns_t tableColumns;
|
|
|
public:
|
|
|
// Ensure DB is not copiable or assignable
|
|
|
ADatabase(const ADatabase&) = delete;
|
|
|
void operator=(const ADatabase&) = delete;
|
|
|
static ADatabase* instance();
|
|
|
- TableNames getTableNames() const;
|
|
|
- ColumnNames getTableColumns(TableName table_name) const;
|
|
|
+ TableNames_t getTableNames() const;
|
|
|
+ ColumnNames_t getTableColumns(TableName_t table_name) const;
|
|
|
void updateLayout();
|
|
|
const QString sqliteVersion();
|
|
|
|
|
@@ -183,7 +170,7 @@ public:
|
|
|
/*!
|
|
|
* \brief retreive entry data from the database to create an entry object
|
|
|
*/
|
|
|
- RowData getEntryData(DataPosition data_position);
|
|
|
+ RowData_t getEntryData(DataPosition data_position);
|
|
|
|
|
|
/*!
|
|
|
* \brief retreive an Entry from the database.
|
|
@@ -198,7 +185,7 @@ public:
|
|
|
* instead of an Entry. It allows for easy access to a pilot entry
|
|
|
* with only the RowId required as input.
|
|
|
*/
|
|
|
- APilotEntry getPilotEntry(RowId row_id);
|
|
|
+ APilotEntry getPilotEntry(RowId_t row_id);
|
|
|
|
|
|
/*!
|
|
|
* \brief retreives a TailEntry from the database.
|
|
@@ -208,7 +195,7 @@ public:
|
|
|
* instead of an Entry. It allows for easy access to a tail entry
|
|
|
* with only the RowId required as input.
|
|
|
*/
|
|
|
- ATailEntry getTailEntry(RowId row_id);
|
|
|
+ ATailEntry getTailEntry(RowId_t row_id);
|
|
|
|
|
|
/*!
|
|
|
* \brief retreives a TailEntry from the database.
|
|
@@ -218,7 +205,7 @@ public:
|
|
|
* instead of an AEntry. It allows for easy access to an aircraft entry
|
|
|
* with only the RowId required as input.
|
|
|
*/
|
|
|
- AAircraftEntry getAircraftEntry(RowId row_id);
|
|
|
+ AAircraftEntry getAircraftEntry(RowId_t row_id);
|
|
|
|
|
|
/*!
|
|
|
* \brief retreives a flight entry from the database.
|
|
@@ -228,7 +215,7 @@ public:
|
|
|
* instead of an AEntry. It allows for easy access to a flight entry
|
|
|
* with only the RowId required as input.
|
|
|
*/
|
|
|
- AFlightEntry getFlightEntry(RowId row_id);
|
|
|
+ AFlightEntry getFlightEntry(RowId_t row_id);
|
|
|
|
|
|
/*!
|
|
|
* \brief getCompletionList returns a QStringList of values for a
|
|
@@ -237,7 +224,7 @@ public:
|
|
|
const QStringList getCompletionList(ADatabaseTarget target);
|
|
|
|
|
|
/*!
|
|
|
- * \brief returns a QMap<QueryResult_qstr, QueryResult_i> of a human-readable database value and
|
|
|
+ * \brief returns a QMap<QString, RowId_t> of a human-readable database value and
|
|
|
* its row id. Used in the Dialogs to map user input to unique database entries.
|
|
|
*/
|
|
|
const QMap<QString, RowId_t> getIdMap(ADatabaseTarget target);
|
|
@@ -251,19 +238,19 @@ public:
|
|
|
* \brief returns a list of ROWID's in the flights table for which foreign key constraints
|
|
|
* exist.
|
|
|
*/
|
|
|
- QList<int> getForeignKeyConstraints(int foreign_row_id, ADatabaseTarget target);
|
|
|
+ QList<RowId_t> getForeignKeyConstraints(RowId_t foreign_row_id, ADatabaseTarget target);
|
|
|
|
|
|
/*!
|
|
|
* \brief Resolves the foreign key in a flight entry
|
|
|
* \return The Pilot Entry referencted by the foreign key.
|
|
|
*/
|
|
|
- APilotEntry resolveForeignPilot(int foreign_key);
|
|
|
+ APilotEntry resolveForeignPilot(ForeignKey_t foreign_key);
|
|
|
|
|
|
/*!
|
|
|
* \brief Resolves the foreign key in a flight entry
|
|
|
* \return The Tail Entry referencted by the foreign key.
|
|
|
*/
|
|
|
- ATailEntry resolveForeignTail(int foreign_key);
|
|
|
+ ATailEntry resolveForeignTail(ForeignKey_t foreign_key);
|
|
|
|
|
|
|
|
|
|