00001 00005 //--------------------------------------------------------------------------- 00006 00007 #ifndef FBwTransacH 00008 #define FBwTransacH 00009 //--------------------------------------------------------------------------- 00010 00011 namespace fbwrap 00012 { 00013 00014 // What are we using from standard libraries 00015 using std::string; 00016 00017 //----------------------------------------------------------------------------- 00020 class FBwDb; 00021 00023 class FBwTransaction 00024 { 00025 isc_tr_handle tr; 00026 string tpb; 00027 bool AutoComit; 00028 FBwDb *mdb; 00029 int debugcount; 00030 public: 00032 enum rw_mode { 00033 READ_ONLY_TRANS, 00034 READ_WRITE_TRANS 00035 }; 00037 00040 FBwTransaction(FBwDb *db); 00042 00046 FBwTransaction(FBwDb *db,rw_mode mode); 00048 bool IsActive() 00049 { 00050 return tr != 0; 00051 } 00052 bool Start(); 00053 void Commit(); 00054 void Rollback(); 00055 ~FBwTransaction(); 00056 isc_tr_handle *GetHandle() 00057 { 00058 return &tr; 00059 } 00060 }; 00061 00063 class FBwROTransaction : public FBwTransaction 00064 { 00065 public: 00066 FBwROTransaction(FBwDb *db) 00067 :FBwTransaction(db,FBwTransaction::READ_ONLY_TRANS) 00068 { 00069 } 00070 }; 00071 00072 //------------------------------------------------------------------------- 00073 } 00074 #endif
1.2.17