|
QGroundControl
Ground Control Station for MAVLink Drones
|
RAII wrapper around QSqlDatabase::addDatabase / removeDatabase. More...
#include <QGCSqlHelper.h>
Public Member Functions | |
| ScopedConnection (const QString &dbPath, bool readOnly=false, const QString &prefix=QStringLiteral("QGCSql")) | |
| ~ScopedConnection () | |
| ScopedConnection (const ScopedConnection &)=delete | |
| ScopedConnection & | operator= (const ScopedConnection &)=delete |
| ScopedConnection (ScopedConnection &&)=delete | |
| ScopedConnection & | operator= (ScopedConnection &&)=delete |
| bool | isValid () const |
| QSqlDatabase | database () const |
RAII wrapper around QSqlDatabase::addDatabase / removeDatabase.
Creates a uniquely-named connection on construction, removes it on destruction. Avoids the common pitfall of reusing connection names or forgetting to call removeDatabase.
Definition at line 40 of file QGCSqlHelper.h.
|
explicit |
Opens a connection to dbPath using the QSQLITE driver. prefix is prepended to the auto-generated connection name; useful for distinguishing concurrent connections in logs / Qt's connection registry. If readOnly is true, QSQLITE_OPEN_READONLY is set.
Definition at line 60 of file QGCSqlHelper.cc.
References QGCSqlHelper::applySqlitePragmas().
| QGCSqlHelper::ScopedConnection::~ScopedConnection | ( | ) |
Definition at line 80 of file QGCSqlHelper.cc.
|
delete |
|
delete |
| QSqlDatabase QGCSqlHelper::ScopedConnection::database | ( | ) | const |
Definition at line 93 of file QGCSqlHelper.cc.
Referenced by QGCTileCacheDatabase::exportSets(), and QGCTileCacheDatabase::importSetsMerge().
|
inline |
Definition at line 56 of file QGCSqlHelper.h.
Referenced by QGCTileCacheDatabase::exportSets(), and QGCTileCacheDatabase::importSetsMerge().
|
delete |
|
delete |