QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCSqlHelper::ScopedConnection Class Reference

#include <QGCSqlHelper.h>

Public Member Functions

 ScopedConnection (const QString &dbPath, bool readOnly=false)
 
 ~ScopedConnection ()
 
 ScopedConnection (const ScopedConnection &)=delete
 
ScopedConnectionoperator= (const ScopedConnection &)=delete
 
bool isValid () const
 
QSqlDatabase database () const
 

Detailed Description

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 26 of file QGCSqlHelper.h.

Constructor & Destructor Documentation

◆ ScopedConnection() [1/2]

QGCSqlHelper::ScopedConnection::ScopedConnection ( const QString &  dbPath,
bool  readOnly = false 
)
explicit

Opens a connection to dbPath using the QSQLITE driver. If readOnly is true, QSQLITE_OPEN_READONLY is set.

Definition at line 29 of file QGCSqlHelper.cc.

References QGCSqlHelper::applySqlitePragmas().

◆ ~ScopedConnection()

QGCSqlHelper::ScopedConnection::~ScopedConnection ( )

Definition at line 49 of file QGCSqlHelper.cc.

◆ ScopedConnection() [2/2]

QGCSqlHelper::ScopedConnection::ScopedConnection ( const ScopedConnection )
delete

Member Function Documentation

◆ database()

QSqlDatabase QGCSqlHelper::ScopedConnection::database ( ) const

Definition at line 62 of file QGCSqlHelper.cc.

◆ isValid()

bool QGCSqlHelper::ScopedConnection::isValid ( ) const
inline

Definition at line 37 of file QGCSqlHelper.h.

◆ operator=()

ScopedConnection & QGCSqlHelper::ScopedConnection::operator= ( const ScopedConnection )
delete

The documentation for this class was generated from the following files: