Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

FBwDB.h

Go to the documentation of this file.
00001 
00004 //---------------------------------------------------------------------------
00005 #ifndef FBwDBH
00006 #define FBwDBH
00007 #include <FBwLst.h>
00008 
00009 //---------------------------------------------------------------------------
00011 namespace fbwrap
00012 {
00013 
00014 using std::string;
00015 
00017 class FBwAttachDb : public FBwSPB
00018 {
00019 public:
00021 
00025     FBwAttachDb(const FBwServerDsc &alias);
00026 };
00027 
00029 
00039 class FBwDb
00040 {
00041     isc_db_handle hdb;
00042     string DbName;
00043     FBwServerDsc alias;
00044     ISC_STATUS status[20];
00045     // named transactions list
00046     SimList<FBwTransaction> trlist;
00047     FBwTransaction *tr;
00048 protected:
00049 public:
00051     FBwDb();
00053 
00058     FBwDb(const FBwServerDsc &pAlias, string pDbName, bool autoconnect=true);
00060     void Close();
00062     void SetLogin(const FBwServerDsc &pAlias, string pDbName);
00064     bool Open();
00066     bool IsOpen() const
00067     {
00068         return hdb != 0;
00069     }
00071 
00074     virtual ~FBwDb()
00075     {
00076         Close();
00077         trlist.Destroy();
00078     }
00080     bool InTransaction()
00081     {
00082         return tr->IsActive();
00083     }
00085     void GetLastError(BasicFBwErrorMgr *err) const
00086     {
00087         err->Assign(status);
00088     }
00090     bool StartTransaction();
00092     bool StartTransaction(string name);
00094     FBwTransaction *GetTransaction()
00095     {
00096         return tr;
00097     }
00099     FBwTransaction *GetTransaction(string trname);
00101     isc_tr_handle *TransHandle()
00102     {
00103         return tr->GetHandle();
00104     }
00106     void Commit();
00108     void CommitAll();
00110     void Commit(string trname);
00112     void Rollback();
00114     void RollbackAll();
00116     void Rollback(string trname);
00118     isc_db_handle *GetHandle()
00119     {
00120         return &hdb;
00121     }
00123     ISC_STATUS *GetStatus()
00124     {
00125         return status;
00126     }
00127 };
00128 
00129 extern char DEFAULT_TRANSACTION[];      // rw no blocking read commited
00130 extern char READ_ONLY_TRANSACTION[];    // readonly transaction
00131 
00132 //-------------------------------------------------------------------------
00133 }
00134 #endif

Generated on Fri Jan 31 08:30:01 2003 for fbwrap by doxygen1.2.17