QtDataSync
4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
|
A wrapper around QSqlDatabase to manage the connections. More...
#include <defaults.h>
Public Member Functions | |
DatabaseRef () | |
Default constructor. Constructs an invalid database reference. | |
DatabaseRef (DatabaseRef &&other) noexcept | |
Move constructor. | |
DatabaseRef & | operator= (DatabaseRef &&other) noexcept |
Move assignment operator. | |
bool | isValid () const |
Returns true if this reference points to a valid database. | |
QSqlDatabase | database () const |
Returns the database that is managed by this reference. | |
operator QSqlDatabase () const | |
Implicit cast operator to the managed database. | |
QSqlDatabase * | operator-> () const |
Arrow operator to access the database. | |
void | drop () |
Drops the reference to the database early. | |
A wrapper around QSqlDatabase to manage the connections.
Internally, this class holds a reference to a sqlite database. The first reference created form a Defaults instance will also create the database connection. From there on, the references to the database are counted with this class. Once the last instance gets destroyed, the database connection closes and gets deleted. Because of this it's important to not extract the QSqlDatabase from this class to "permanent" variable. Try to use the reference class where possible and only pass the internal database to scoped objects.
Definition at line 28 of file defaults.h.