# 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:
  1. Constructor.
  2. Copy constructor.
  3. Move constructor.
[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

  1. Constructor.
    Transaction(const base::ObjectHandle<Executor>& executor, const provider::ResourceHandle<Connection>& connection = nullptr)
  2. Copy constructor.
    • @param other
    Transaction(const Transaction& other) = delete
  3. 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()