experimental::Database(3)

NAME
experimental::Database - The DB class encapsulates the SQL database by providing fast access to hot database data.

SYNOPSIS

#include <database.h>

Inherits QObject.

  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
Database (const Database &)=delete
void operator= (const Database &)=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.
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.
ATailEntry getTailEntry (RowId row_id)
retreives a TailEntry from the database.
AAircraftEntry getAircraftEntry (RowId row_id)
retreives a TailEntry from the database.
AFlightEntry getFlightEntry (RowId row_id)
retreives a flight entry from the database.
const QStringList getCompletionList (DatabaseTarget)
getCompletionList returns a QStringList of values for a QCompleter based on database values
const QHash< QString, int > getIdMap (DatabaseTarget)
returns a QHash<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 (DatabaseTarget)
returns the ROWID for the newest entry in the respective database.
QList< int > getForeignKeyConstraints (int foreign_row_id, DatabaseTarget target)
returns a list of ROWID's in the flights table for which foreign key constraints exist.

  Static Public Member Functions
static Database * getInstance ()
static QSqlDatabase database ()
Can be used to access the database connection.

  Public Attributes
DatabaseError lastError

Detailed Description

The DB class encapsulates the SQL database by providing fast access to hot database data.

Member Function Documentation

  QVector< QString > experimental::Database::customQuery (QString statement, int return_values)

Can be used to send a complex query to the database.

Parameters
    query - the full sql query statement
    returnValues - the number of return values

  QSqlDatabase experimental::Database::database () [static]

Can be used to access the database connection.

Returns
    The QSqlDatabase object pertaining to the connection.

  AAircraftEntry experimental::Database::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::Database::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::Database::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::Database::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.

Author

Generated automatically by Doxygen for openPilotLog from the source code.