The Battle for Wesnoth  1.15.5+dev
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
mariadb::transaction Class Reference

Class representing a SQL transaction having automatic rollback functionality. More...

#include <transaction.hpp>

Public Member Functions

virtual ~transaction ()
 Destructor initiates automatic rollback if changes were not committed. More...
 
void commit ()
 Commits the changes, releases all savepoints. More...
 
save_point_ref create_save_point ()
 Create named savepoint Note: only valid until the transaction is destroyed or committed. More...
 

Private Member Functions

 transaction (connection *conn, isolation::level level, bool consistent_snapshot)
 Create a transaction with given isolation level and snapshot setting. More...
 
void remove_save_point (save_point *sv_point)
 Removes a savepoint from the list of savepoints. More...
 
void cleanup ()
 Cleans up the transaction, releases all savepoints. More...
 

Private Attributes

connectionm_connection
 
std::vector< save_point * > m_save_points
 

Friends

class connection
 
class save_point
 

Detailed Description

Class representing a SQL transaction having automatic rollback functionality.

Definition at line 25 of file transaction.hpp.

Constructor & Destructor Documentation

◆ ~transaction()

transaction::~transaction ( )
virtual

Destructor initiates automatic rollback if changes were not committed.

Definition at line 36 of file transaction.cpp.

References cleanup(), m_connection, and mariadb::connection::m_mysql.

◆ transaction()

transaction::transaction ( connection conn,
isolation::level  level,
bool  consistent_snapshot 
)
private

Create a transaction with given isolation level and snapshot setting.

Parameters
connConnection to start transaction on
levelLevel of database isolation to use
consistent_snapshotControls whether the transaction needs a consistent snapshot on creation

Definition at line 30 of file transaction.cpp.

References mariadb::connection::execute().

Member Function Documentation

◆ cleanup()

void transaction::cleanup ( )
private

Cleans up the transaction, releases all savepoints.

Definition at line 43 of file transaction.cpp.

References m_save_points, and mariadb::save_point::m_transaction.

Referenced by commit(), and ~transaction().

◆ commit()

void transaction::commit ( )

Commits the changes, releases all savepoints.

Definition at line 49 of file transaction.cpp.

References cleanup(), m_connection, and mariadb::connection::m_mysql.

◆ create_save_point()

save_point_ref transaction::create_save_point ( )

Create named savepoint Note: only valid until the transaction is destroyed or committed.

Returns
Reference to a unique new savepoint

Definition at line 57 of file transaction.cpp.

References m_connection, m_save_points, and save_point.

◆ remove_save_point()

void transaction::remove_save_point ( save_point sv_point)
private

Removes a savepoint from the list of savepoints.

Parameters
sv_pointsavepoint to remove

Definition at line 65 of file transaction.cpp.

References m_save_points, and gui2::dialogs::tip::remove().

Referenced by mariadb::save_point::commit(), and mariadb::save_point::~save_point().

Friends And Related Function Documentation

◆ connection

friend class connection
friend

Definition at line 26 of file transaction.hpp.

◆ save_point

friend class save_point
friend

Definition at line 27 of file transaction.hpp.

Referenced by create_save_point().

Member Data Documentation

◆ m_connection

connection* mariadb::transaction::m_connection
private

◆ m_save_points

std::vector<save_point*> mariadb::transaction::m_save_points
private

Definition at line 75 of file transaction.hpp.

Referenced by cleanup(), create_save_point(), and remove_save_point().


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