openPilotLog
|
The DB class encapsulates the SQL database by providing fast access to hot database data. More...
#include <adatabase.h>
Signals | |
void | dataBaseUpdated () |
updated is emitted whenever the database contents have been updated. This can be either a commit, update or remove. This signal should be used to trigger an update to the models of the views displaying database contents in the user interface so that a user is always presented with up-to-date information. | |
Public Member Functions | |
ADatabase (const ADatabase &)=delete | |
void | operator= (const ADatabase &)=delete |
bool | connect () |
Connect to the database and populate database information. | |
void | disconnect () |
closes the database connection. | |
QVector< QString > | customQuery (QString statement, int return_values) |
Can be used to send a complex query to the database. More... | |
bool | exists (AEntry entry) |
Checks if an entry exists in the database, based on position data. | |
bool | exists (DataPosition data_position) |
bool | commit (AEntry entry) |
commits an entry to the database, calls either insert or update, based on position data | |
bool | insert (AEntry new_entry) |
Create new entry in the databse based on UserInput. | |
bool | update (AEntry updated_entry) |
Updates entry in database from existing entry tweaked by the user. | |
bool | remove (AEntry entry) |
deletes an entry from the database. | |
bool | removeMany (QList< DataPosition >) |
deletes a list of entries from the database. Optimised for speed when deleting many entries. | |
TableData | getEntryData (DataPosition data_position) |
retreive entry data from the database to create an entry object | |
AEntry | getEntry (DataPosition data_position) |
retreive an Entry from the database. | |
APilotEntry | getPilotEntry (RowId row_id) |
retreives a PilotEntry from the database. More... | |
ATailEntry | getTailEntry (RowId row_id) |
retreives a TailEntry from the database. More... | |
AAircraftEntry | getAircraftEntry (RowId row_id) |
retreives a TailEntry from the database. More... | |
AFlightEntry | getFlightEntry (RowId row_id) |
retreives a flight entry from the database. More... | |
const QStringList | getCompletionList (ADatabaseTarget) |
getCompletionList returns a QStringList of values for a QCompleter based on database values | |
const QMap< QString, int > | getIdMap (ADatabaseTarget) |
returns a QMap<QString, int> of a human-readable database value and its row id. Used in the Dialogs to map user input to unique database entries. | |
int | getLastEntry (ADatabaseTarget) |
returns the ROWID for the newest entry in the respective database. | |
QList< int > | getForeignKeyConstraints (int foreign_row_id, ADatabaseTarget target) |
returns a list of ROWID's in the flights table for which foreign key constraints exist. | |
Static Public Member Functions | |
static ADatabase * | getInstance () |
static QSqlDatabase | database () |
Can be used to access the database connection. More... | |
Public Attributes | |
ADatabaseError | lastError |
The DB class encapsulates the SQL database by providing fast access to hot database data.
QVector< QString > experimental::ADatabase::customQuery | ( | QString | statement, |
int | return_values | ||
) |
Can be used to send a complex query to the database.
query | - the full sql query statement |
returnValues | - the number of return values |
|
static |
Can be used to access the database connection.
AAircraftEntry experimental::ADatabase::getAircraftEntry | ( | RowId | row_id | ) |
retreives a TailEntry from the database.
This function is a wrapper for DataBase::getEntry(DataPosition), where the table is already set and which returns an AAircraftEntry instead of an AEntry. It allows for easy access to an aircraft entry with only the RowId required as input.
AFlightEntry experimental::ADatabase::getFlightEntry | ( | RowId | row_id | ) |
retreives a flight entry from the database.
This function is a wrapper for DataBase::getEntry(DataPosition), where the table is already set and which returns an AFlightEntry instead of an AEntry. It allows for easy access to a flight entry with only the RowId required as input.
APilotEntry experimental::ADatabase::getPilotEntry | ( | RowId | row_id | ) |
retreives a PilotEntry from the database.
This function is a wrapper for DataBase::getEntry(DataPosition), where the table is already set and which returns a PilotEntry instead of an Entry. It allows for easy access to a pilot entry with only the RowId required as input.
ATailEntry experimental::ADatabase::getTailEntry | ( | RowId | row_id | ) |
retreives a TailEntry from the database.
This function is a wrapper for DataBase::getEntry(DataPosition), where the table is already set and which returns a TailEntry instead of an Entry. It allows for easy access to a tail entry with only the RowId required as input.