// $Id: IDbiException.cxx,v 1.1 2011/01/18 05:49:19 finch Exp $ #include #include "TSQLServer.h" #include "TSQLStatement.h" #include "IDbiException.hxx" #include #include using std::endl; ClassImp(COMET::IDbiException) // Definition of static data members // ********************************* // Definition of all member functions (static or otherwise) // ******************************************************* // // - ordered: ctors, dtor, operators then in alphabetical order. //..................................................................... /// Create an exception using the msg and code provided. COMET::IDbiException::IDbiException(const char* msg /*= 0*/, Int_t code /* = -1 */): fMessage(msg), fErrorCode(code) { COMETTrace( "Creating COMET::IDbiException" << " "); } //..................................................................... /// Create an exception, getting the error message and code from server. COMET::IDbiException::IDbiException(const TSQLServer& server): fMessage(server.GetErrorMsg()), fErrorCode(server.GetErrorCode()) { COMETTrace( "Creating COMET::IDbiException" << " "); } //..................................................................... /// Create and exception, taking the message and code from statement. COMET::IDbiException::IDbiException(const TSQLStatement& statement): fMessage(statement.GetErrorMsg()), fErrorCode(statement.GetErrorCode()) { COMETTrace( "Creating COMET::IDbiException" << " "); } //..................................................................... COMET::IDbiException::IDbiException(const COMET::IDbiException& that) { COMETTrace( "Creating COMET::IDbiException" << " "); *this = that; } //..................................................................... COMET::IDbiException::~IDbiException() { COMETTrace( "Destroying COMET::IDbiException" << " "); } //..................................................................... /// Append message describing this exception to the std::ostream 'os'. std::ostream& operator<<(std::ostream& os, const COMET::IDbiException& e) { os << "Error " << e.GetErrorCode() << " (" << e.GetMessage() << ")" << endl; return os; }