00001 #ifndef _CTBodbcConnect_HXX 00002 #define _CTBodbcConnect_HXX 1 00003 // 00004 // $Id: CTBodbcConnect.hxx,v 1.6 1999/05/10 08:06:45 mueller Exp $ 00005 // 00006 /*----------------------------------------------------------------------------*/ 00007 /* C Tool Box: Designed and implemented by: */ 00008 /* Walter F.J. Mueller Gesellschaft fuer Schwerionenforschung (GSI) */ 00009 /* Planckstrasse 1, D-64291 Darmstadt, Germany */ 00010 /* Email: W.F.J.Mueller@gsi.de */ 00011 /* WWW: http://www-kp3.gsi.de/www/kp3/people/mueller.html */ 00012 /*------------------------------------------+---------------------------------*/ 00013 00014 #include "CTBcstring.hxx" 00015 00016 class CTBodbcStatement; // forward declaration for friend 00017 00018 class CTBodbcConnect { 00019 public: 00020 00021 friend class CTBodbcStatement; 00022 00023 CTBodbcConnect(); 00024 ~CTBodbcConnect(); 00025 00026 bool Connect(const char* c_dcs); 00027 bool Disconnect(); 00028 bool Connected() const; 00029 00030 bool AutoCommit(bool b_val); 00031 00032 bool Commit(); 00033 bool Rollback(); 00034 00035 bool Trace(bool b_trace); 00036 00037 void PrintError(ostream& os = cout); 00038 00039 HENV& Henv(); 00040 HDBC& Hdbc(); 00041 00042 void ToStream(ostream& os = cout) const; 00043 00044 bool operator!() const; 00045 operator bool() const; 00046 00047 private: 00048 00049 void TraceODBCCall(const char* c_text, RETCODE i_rc); 00050 00051 void PrintInfo(UWORD i_infotype, const char* c_prefix, 00052 ostream& os = cout) const; 00053 00054 HDBC m_hdbc; 00055 bool mb_connected; 00056 bool mb_trace; 00057 00058 static HENV m_henv; 00059 }; 00060 00061 ostream& operator<<(ostream& os, const CTBodbcConnect& obj); 00062 00063 #if !(defined(CTB__OutLine) || defined(CTBodbcConnect__OutLine)) 00064 #include "CTBodbcConnect.icc" 00065 #endif 00066 00067 #endif