src/db/databaseconnection.cpp
DatabaseConnection::DatabaseConnection() {
  QString dbPath = Constants::dbLocation();
  const QString DRIVER("QSQLITE");
  if (QSqlDatabase::isDriverAvailable(DRIVER)) {
    db = QSqlDatabase::addDatabase(DRIVER);
    db.setDatabaseName(dbPath);
    auto dbFileRoot = dbPath.left(dbPath.lastIndexOf("/"));
    QDir().mkpath(dbFileRoot);
  }
  else {
    throw DBDriverUnavailableError("SQLite");
  }
}
// DatabaseConnection constructs a connection to the database, unsurpringly. Note that the
// constructor can throw a error (see below). Additionally, many methods can throw a QSqlError,
// though are not marked as such in their comments. Other errors are listed in throw comments, or
// are marked as noexcept if no error is possible.
//
// Throws: DBDriverUnavailable if the required database driver does not exist
DatabaseConnection constructs a connection to the database, unsurpringly. Note that the
constructor can throw a error . Additionally, many methods can throw a QSqlError,
though are not marked as such in their comments. Other errors are listed in throw comments, or
are marked as noexcept if no error is possible.

DBDriverUnavailable if the required database driver does not exist
DatabaseConnection constructs a connection to the database unsurpringly . Note that the constructor can throw a error . Additionally many methods can throw a QSqlError though are not marked as such in their comments . Other errors are listed in throw comments or are marked as noexcept if no error is possible . DBDriverUnavailable if the required database driver does not exist
DatabaseConnection::DatabaseConnection() {
  QString dbPath = Constants::dbLocation();
  const QString DRIVER("QSQLITE");
  if (QSqlDatabase::isDriverAvailable(DRIVER)) {
    db = QSqlDatabase::addDatabase(DRIVER);
    db.setDatabaseName(dbPath);
    auto dbFileRoot = dbPath.left(dbPath.lastIndexOf("/"));
    QDir().mkpath(dbFileRoot);
  }
  else {
    throw DBDriverUnavailableError("SQLite");
  }
}
DatabaseConnection :: DatabaseConnection ( ) { QString dbPath = Constants :: dbLocation ( ) ; const QString DRIVER ( " " ) ; if ( QSqlDatabase :: isDriverAvailable ( DRIVER ) ) { db = QSqlDatabase :: addDatabase ( DRIVER ) ; db . setDatabaseName ( dbPath ) ; auto dbFileRoot = dbPath . left ( dbPath . lastIndexOf ( " " ) ) ; QDir ( ) . mkpath ( dbFileRoot ) ; } else { throw DBDriverUnavailableError ( " " ) ; } }
DatabaseConnection constructs a connection to the database, unsurpringly.
DatabaseConnection constructs a connection to the database unsurpringly .