00001 #ifndef DBIEXCEPTIONLOG
00002 #define DBIEXCEPTIONLOG
00003
00004
00008
00030 #include <iosfwd>
00031 #include <string>
00032 #include <vector>
00033
00034 #include "Rtypes.h"
00035
00036 #include "DatabaseInterface/DbiException.h"
00037
00038 class TSQLServer;
00039 class TSQLStatement;
00040 class DbiExceptionLog;
00041
00042 std::ostream& operator<<(std::ostream& s, const DbiExceptionLog& el);
00043
00044 class DbiExceptionLog
00045
00046 {
00047
00048 public:
00049 DbiExceptionLog(const DbiException* e = 0);
00050 virtual ~DbiExceptionLog();
00051
00052
00053
00054 Bool_t IsEmpty() const { return fEntries.size() == 0; }
00055 const std::vector<DbiException>&
00056 GetEntries() const { return fEntries; }
00057 void Print() const;
00058 UInt_t Size() const { return fEntries.size(); }
00059 void Copy(DbiExceptionLog& that, UInt_t start=0) const;
00060
00061
00062
00063 void AddLog(const DbiExceptionLog& el);
00064 void AddEntry(const DbiException& e) { fEntries.push_back(e); }
00065 void AddEntry(const char* errMsg, Int_t code = -1, Int_t dbType = -1) {
00066 this->AddEntry(DbiException(errMsg,code,dbType));}
00067 void AddEntry(const std::string& errMsg, Int_t code = -1, Int_t dbType = -1) {
00068 this->AddEntry(DbiException(errMsg.c_str(),code,dbType));}
00069 void AddEntry(const TSQLServer& server, Int_t dbType = -1) {
00070 this->AddEntry(DbiException(server,dbType));}
00071 void AddEntry(const TSQLStatement& statement, Int_t dbType = -1) {
00072 this->AddEntry(DbiException(statement,dbType));}
00073 void Clear() { fEntries.clear(); }
00074
00075
00076 static DbiExceptionLog& GetGELog() { return fgGELog;}
00077
00078 private:
00079
00080
00081
00082
00083 private:
00084
00086 std::vector<DbiException> fEntries;
00087
00089 static DbiExceptionLog fgGELog;
00090
00091
00092
00093 };
00094
00095 #endif // DBIEXCEPTIONLOG
00096