# Transaction.hpp
This File On Github
Ask A Question
API: latest
module: oatpp
#include "oatpp/orm/Transaction.hpp"
# Transaction
Database transaction.
namespace oatpp { namespace orm {
class Transaction {}
}}
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | Transaction | Multiple implementations:
|
[none] | ~Transaction | Virtual destructor. |
provider::ResourceHandle<Connection> | getConnection | Get the database connection associated with the transaction. |
std::shared_ptr<QueryResult> | commit | Commit transaction. |
std::shared_ptr<QueryResult> | rollback | Rollback transaction. |
# Transaction::Transaction
- Constructor.
- @param executor - oatpp::orm::Executor.
- @param connection - database connection.
Transaction(const base::ObjectHandle<Executor>& executor, const provider::ResourceHandle<Connection>& connection = nullptr)
- Copy constructor.
- @param other
Transaction(const Transaction& other) = delete
- Move constructor.
- @param other
Transaction(Transaction&& other)
# Transaction::~Transaction
Virtual destructor.
Will automatically call Transaction::rollback() if there was no prior call to Transaction::commit() method.
virtual ~Transaction()
# Transaction::getConnection
Get the database connection associated with the transaction.
Note: all database queries within the transaction MUST be called on this connection.
- @return
provider::ResourceHandle<Connection> getConnection() const
# Transaction::commit
Commit transaction.
- @return
std::shared_ptr<QueryResult> commit()
# Transaction::rollback
Rollback transaction.
- @return
std::shared_ptr<QueryResult> rollback()