2016-08-15 07:09:58 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "transactions/transaction.hpp"
|
|
|
|
|
|
|
|
class Db;
|
|
|
|
class DbAccessor;
|
|
|
|
|
|
|
|
// Inner structures local to transaction can hold ref to this structure and use
|
|
|
|
// its methods.
|
2016-08-18 22:34:36 +08:00
|
|
|
// Also serves as a barrier for calling methods defined public but meant for
|
|
|
|
// internal use. That kind of method should request DbTransaction&.
|
2016-08-15 07:09:58 +08:00
|
|
|
class DbTransaction
|
|
|
|
{
|
|
|
|
friend DbAccessor;
|
|
|
|
|
|
|
|
public:
|
|
|
|
DbTransaction(Db &db, tx::Transaction &trans) : db(db), trans(trans) {}
|
|
|
|
|
2016-08-18 22:34:36 +08:00
|
|
|
// Global transactional algorithms,operations and general methods meant for
|
|
|
|
// internal use should be here or should be routed through this object.
|
|
|
|
// This should provide cleaner hierarchy of operations on database.
|
|
|
|
// For example cleaner.
|
2016-08-15 07:09:58 +08:00
|
|
|
|
|
|
|
tx::Transaction &trans;
|
|
|
|
|
|
|
|
Db &db;
|
|
|
|
};
|