00001
00002
00003
00004 #include <iostream>
00005
00006 #include "TSQLServer.h"
00007 #include "TSQLStatement.h"
00008
00009 #include "DatabaseInterface/DbiException.h"
00010 #include "LeakChecker/Lea.h"
00011 #include "MessageService/MsgService.h"
00012
00013 ClassImp(DbiException)
00014
00015
00016
00017
00018 CVSID("$Id: DbiException.cxx,v 1.4 2007/04/26 14:19:57 west Exp $");
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 DbiException::DbiException(const char* msg ,
00029 Int_t code ,
00030 Int_t dbType ):
00031 fMessage(msg),
00032 fErrorCode(code),
00033 fDbType(dbType)
00034 {
00035
00036 LEA_CTOR
00037 MSG("Dbi", Msg::kVerbose) << "Creating DbiException" << endl;
00038
00039 }
00040
00041
00042
00043 DbiException::DbiException(const TSQLServer& server,
00044 Int_t dbType ):
00045 fMessage(server.GetErrorMsg()),
00046 fErrorCode(server.GetErrorCode()),
00047 fDbType(dbType)
00048 {
00049
00050 LEA_CTOR
00051 MSG("Dbi", Msg::kVerbose) << "Creating DbiException" << endl;
00052
00053 }
00054
00055
00056
00057 DbiException::DbiException(const TSQLStatement& statement,
00058 Int_t dbType ):
00059 fMessage(statement.GetErrorMsg()),
00060 fErrorCode(statement.GetErrorCode()),
00061 fDbType(dbType)
00062 {
00063
00064 LEA_CTOR
00065 MSG("Dbi", Msg::kVerbose) << "Creating DbiException" << endl;
00066
00067 }
00068
00069
00070
00071
00072 DbiException::DbiException(const DbiException& that)
00073 {
00074
00075 LEA_CTOR
00076 MSG("Dbi", Msg::kVerbose) << "Creating DbiException" << endl;
00077
00078 *this = that;
00079
00080 }
00081
00082
00083
00084
00085 DbiException::~DbiException() {
00086
00087
00088 LEA_DTOR
00089 MSG("Dbi", Msg::kVerbose) << "Destroying DbiException" << endl;
00090
00091 }
00092
00093
00094
00095 std::ostream& operator<<(std::ostream& os, const DbiException& e) {
00096
00097 os << "Error " << e.GetErrorCode()
00098 << " (" << e.GetMessage() << ") from DB type " << e.GetDbType() << endl;
00099 return os;
00100
00101 }