cutelyst
4.5.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
|
This is a helper class to create scoped transactions. More...
#include <Cutelyst/Plugins/Utils/Sql>
Public Member Functions | |
Transaction (const QSqlDatabase &database) | |
Transaction (const QString &databaseName=QString()) | |
~Transaction () | |
bool | commit () |
bool | rollback () |
bool | transaction () const |
This is a helper class to create scoped transactions, when you create a local Transaction object it will automatically open a transaction, you can check if the transaction was created successfully by calling transaction(),
Once this object goes out of scope it will automatically rollback the transaction if the transaction was open and commit() was not called. It helps you forgetting to rollback a transaction in case of an error.
Creates a Transaction using the databaseName that you would pass to Sql::databaseNameThread().
Definition at line 273 of file sql.cpp.
References QSqlDatabase::transaction().
Sql::Transaction::Transaction | ( | const QSqlDatabase & | database | ) |
Creates a Transaction using the database that you would get for example from Sql::databaseThread().
Definition at line 279 of file sql.cpp.
References QSqlDatabase::transaction().
Sql::Transaction::~Transaction | ( | ) |
bool Sql::Transaction::commit | ( | ) |
bool Sql::Transaction::rollback | ( | ) |