00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #if !defined(MYSQLPP_TRANSACTION_H)
00033 #define MYSQLPP_TRANSACTION_H
00034
00035 #include "common.h"
00036
00037 namespace mysqlpp {
00038
00039 #if !defined(DOXYGEN_IGNORE)
00040
00041 class MYSQLPP_EXPORT Connection;
00042 #endif
00043
00045
00046 class MYSQLPP_EXPORT Transaction
00047 {
00048 public:
00055 enum IsolationLevel {
00056 read_uncommitted,
00057 read_committed,
00058 repeatable_read,
00059 serializable
00060 };
00061
00066
00067 enum IsolationScope {
00068 this_transaction,
00069 session,
00070 global
00071 };
00072
00079 Transaction(Connection& conn, bool consistent = false);
00080
00090 Transaction(Connection& conn, IsolationLevel level,
00091 IsolationScope scope = this_transaction,
00092 bool consistent = false);
00093
00102 ~Transaction();
00103
00111 void commit();
00112
00119 void rollback();
00120
00121 private:
00122 Connection& conn_;
00123 bool finished_;
00124 };
00125
00126
00137 class MYSQLPP_EXPORT NoTransaction
00138 {
00139 public:
00141 NoTransaction(Connection&, bool = false)
00142 {
00143 }
00144
00146 ~NoTransaction() { }
00147
00149 void commit() { }
00150
00152 void rollback() { }
00153 };
00154
00155 }
00156
00157 #endif // !defined(MYSQLPP_TRANSACTION_H)
00158