SQLiteXX  0.1.0
 All Classes Namespaces Files Functions Enumerations Enumerator
Transaction.h
Go to the documentation of this file.
1 
3 #ifndef __SQLITEXX_SQLITE_TRANSACTION_H__
4 #define __SQLITEXX_SQLITE_TRANSACTION_H__
5 
6 #include "DBConnection.h"
7 #include "Statement.h"
8 
9 #include <sqlite3.h>
10 
11 
12 namespace sqlite
13 {
14 
17  enum class transactiontype: int {
18  deferred,
19  immediate,
20  exclusive
21  };
22 
23 
27  {
28  public:
29  const transactiontype type;
30 
35  transaction(dbconnection& connection, const transactiontype type);
36 
40  virtual ~transaction() noexcept;
41 
44  virtual void commit();
45 
46  private:
47 
48  dbconnection m_connection;
49  bool m_commited;
50 
51  transaction(const transaction&) = delete;
52  transaction& operator=(const transaction&) = delete;
53  };
54 
58  {
59  public:
65  {}
66  };
67 
71  {
72  public:
78  {}
79  };
80 
84  {
85  public:
91  {}
92  };
93 }
94 
95 
96 #endif
virtual ~transaction() noexcept
Destructor.
Definition: Transaction.cpp:19
means that no database connection will be able to write to the database or do a BEGIN IMMEDIATE/EXCLU...
exclusive_transaction(dbconnection &connection)
Implements a strictly scope-based SQLite exclusive transaction.
Definition: Transaction.h:89
transaction(dbconnection &connection, const transactiontype type)
Implements a strictly scope-based SQLite transaction.
Definition: Transaction.cpp:10
RAII encapsulation of the SQLite Transactions.
Definition: Transaction.h:26
virtual void commit()
Commit the transaction.
Definition: Transaction.cpp:32
RAII encapsulation of the SQLite deferred transaction.
Definition: Transaction.h:57
means that no other database connection except for read_uncommitted connection will be able to read/w...
means that no locks are acquired on the database until the database is first accessed.
deferred_transaction(dbconnection &connection)
Implements a strictly scope-based SQLite deferred transaction.
Definition: Transaction.h:63
RAII encapsulation of the SQLite immediate transaction.
Definition: Transaction.h:70
immediate_transaction(dbconnection &connection)
Implements a strictly scope-based SQLite immediate transaction.
Definition: Transaction.h:76
Class that represents a connection to a database.
Definition: DBConnection.h:24
transactiontype
Used to specify the different types of SQLite transactions.
Definition: Transaction.h:17
RAII encapsulation of the SQLite exclusive transaction.
Definition: Transaction.h:83