The DB class encapsulates the SQL database by providing fast access to hot database data.  
 More...
 | 
| 
  | 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. 
  | 
|   | 
| 
void  | updateLayout () | 
|   | Updates the member variables tableNames and tableColumns with up-to-date layout information if the database has been altered. This function is normally only required during database setup or maintenance. 
  | 
|   | 
| 
const QString  | version () const | 
|   | Return the database revision number (not the sqlite version number). 
  | 
|   | 
| const QString  | sqliteVersion () const | 
|   | Database::sqliteVersion returns the database sqlite version. See also dbRevision()  More...
  | 
|   | 
| 
const QStringList  | getTableNames () const | 
|   | Return the names of all tables in the database. 
  | 
|   | 
| 
const QStringList  | getTableColumns (OPL::DbTable table_name) const | 
|   | Return the names of a given table in the database. 
  | 
|   | 
| QVector< QVariant >  | customQuery (QString statement, int return_values) | 
|   | Can be used to send a complex query to the database.  More...
  | 
|   | 
| 
bool  | exists (const OPL::Row &row) | 
|   | Checks if an entry exists in the database, based on position data. 
  | 
|   | 
| 
bool  | clear () | 
|   | clear resets the database, i.e. deletes all content in the tables containing userdata (pilots, flights, tails) 
  | 
|   | 
| 
bool  | commit (const OPL::Row &row) | 
|   | commits an entry to the database, calls either insert or update, based on position data 
  | 
|   | 
| bool  | commit (const QJsonArray &json_arr, const OPL::DbTable table) | 
|   | commits data imported from JSON  More...
  | 
|   | 
| 
bool  | insert (const OPL::Row &new_row) | 
|   | Create new entry in the databse based on UserInput. 
  | 
|   | 
| 
bool  | update (const OPL::Row &updated_row) | 
|   | Updates entry in database from existing entry tweaked by the user. 
  | 
|   | 
| 
bool  | remove (const OPL::Row &row) | 
|   | deletes an entry from the database. 
  | 
|   | 
| 
bool  | removeMany (OPL::DbTable table, const QList< int > &row_id_list) | 
|   | deletes a batch of entries from the database. Optimised for speed when deleting many entries. The entries are identified using their row id 
  | 
|   | 
| 
OPL::Row  | getRow (const OPL::DbTable table, const int row_id) | 
|   | retreive a Row from the database 
  | 
|   | 
| 
RowData_T  | getRowData (const OPL::DbTable table, const int row_id) | 
|   | retreive a Map of <column name, column content> for a specific row in the database. 
  | 
|   | 
| 
OPL::PilotEntry  | getPilotEntry (int row_id) | 
|   | retreives a PilotEntry from the database. See row class for details. 
  | 
|   | 
| 
OPL::TailEntry  | getTailEntry (int row_id) | 
|   | retreives a TailEntry from the database. See row class for details. 
  | 
|   | 
| 
OPL::AircraftEntry  | getAircraftEntry (int row_id) | 
|   | retreives a TailEntry from the database. See row class for details. 
  | 
|   | 
| 
OPL::FlightEntry  | getFlightEntry (int row_id) | 
|   | retreives a flight entry from the database. See row class for details. 
  | 
|   | 
| 
OPL::SimulatorEntry  | getSimEntry (int row_id) | 
|   | retreives a Simulator entry from the database. See row class for details. 
  | 
|   | 
| 
OPL::CurrencyEntry  | getCurrencyEntry (int row_id) | 
|   | Retreives a currency entry from the database. See row class for details. 
  | 
|   | 
| 
OPL::AirportEntry  | getAirportEntry (int row_id) | 
|   | Retreives an airport entry from the database. See row class for details. 
  | 
|   | 
| 
int  | getLastEntry (OPL::DbTable table) | 
|   | returns the ROWID for the newest entry in the respective table. 
  | 
|   | 
| 
QList< int >  | getForeignKeyConstraints (int foreign_row_id, OPL::DbTable table) | 
|   | returns a list of ROWID's in the flights table for which foreign key constraints exist. 
  | 
|   | 
| QVector< RowData_T >  | getTable (OPL::DbTable table) | 
|   | getTable returns all contents of a given table from the database  More...
  | 
|   | 
| 
const QList< OPL::DbTable > &  | getUserTables () const | 
|   | getUserTables returns a list of the of the tables that contain user-created data (flights, pilots,..) 
  | 
|   | 
| 
const QList< OPL::DbTable > &  | getTemplateTables () const | 
|   | getTemplateTables returns a list of the tables that contain template data (aiports, aircraft,..) 
  | 
|   | 
| bool  | createSchema () | 
|   | Create or restore the database to its ready-to-use but empty state.  More...
  | 
|   | 
| bool  | importTemplateData (bool use_local_ressources) | 
|   | importTemplateData fills an empty database with the template data (Aircraft, Airports, currencies, changelog) as read from the JSON templates.  More...
  | 
|   | 
| 
bool  | resetUserData () | 
|   | Delete all rows from the user data tables (flights, pliots, tails) 
  | 
|   | 
| bool  | createBackup (const QString &dest_file) | 
|   | Database::createBackup copies the currently used database to an external backup location provided by the user.  More...
  | 
|   | 
| bool  | restoreBackup (const QString &backup_file) | 
|   | Database::restoreBackup restores the database from a given backup file and replaces the currently active database.  More...
  | 
|   | 
The DB class encapsulates the SQL database by providing fast access to hot database data.