00001 #ifndef DBISTATEMENT
00002 #define DBISTATEMENT
00003
00004
00008
00032 #include <list>
00033
00034 #include "TList.h"
00035 #include "TString.h"
00036 #include "TSQLStatement.h"
00037
00038 #include "DatabaseInterface/Dbi.h"
00039 #include "DatabaseInterface/DbiExceptionLog.h"
00040 #include "DatabaseInterface/DbiConnection.h"
00041
00042 class DbiException;
00043
00044 class DbiStatement
00045 {
00046
00047 public:
00048
00049
00050 DbiStatement(DbiConnection& conDb);
00051 virtual ~DbiStatement();
00052
00053
00054
00055 Dbi::DbTypes GetDBType() const { return fDbType; }
00056
00057
00058
00062 Bool_t PrintExceptions(Int_t level = 3) const;
00063
00064 const DbiExceptionLog& GetExceptionLog() const { return fExceptionLog; }
00065
00066
00067
00069 std::list<TString> TestTranslateSQL(const TString& sql, Dbi::DbTypes type);
00070
00071
00072
00074 TSQLStatement* ExecuteQuery(const TString& sql="");
00075
00077 Bool_t ExecuteUpdate( const TString& sql="");
00078
00079 private:
00080
00081 void AppendExceptionLog(DbiException* e) { if ( e ) fExceptionLog.AddEntry(*e); }
00082 void AppendExceptionLog(TSQLStatement* s) { if ( s ) fExceptionLog.AddEntry(*s); }
00083 void AppendExceptionLog(DbiConnection& c) { fExceptionLog.AddLog(c.GetExceptionLog()); }
00084 void ClearExceptionLog() { fExceptionLog.Clear(); }
00085
00086 TSQLStatement* CreateProcessedStatement(const TString& sql="");
00087 std::list<TString> TranslateSQL(const TString& sql);
00088
00089
00090
00092 DbiConnection& fConDb;
00093
00095 Dbi::DbTypes fDbType;
00096
00099 DbiExceptionLog fExceptionLog;
00100
00101 ClassDef(DbiStatement,0)
00102
00103 };
00104
00105
00106 #endif // DBISTATEMENT
00107