Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages   Examples  

OraError.h

00001 #ifndef __ORAERROR_H_
00002 #define __ORAERROR_H_
00003 
00004 #include "ocicpp.h"
00005 #include <exception>
00006 
00007 namespace OCICPP {
00008 
00009 using std::string;
00010 
00011 class OraError: public std::exception {
00012 private:
00013     ErrorType mv_errtype;   
00014     sword status;
00015     sb4 errcode;
00016     OCIError *errhp;
00017 public: 
00018     string message;
00019 
00020 public:
00021 
00022     OraError(OCIError *err,sword stat): mv_errtype(ORAERROR),status(stat),errcode(-1),errhp(err),message ("OCICPP Lib Exception: ") {
00023         text *error;
00024         error=(text *)calloc(512,sizeof(text));
00025         (void) OCIErrorGet((dvoid *)errhp, (ub4) 1, (text *) NULL, &errcode, error, 512, OCI_HTYPE_ERROR);
00026         error[511]='\0';
00027         message += (char *)error;
00028         free(error);
00029     }
00030     OraError(char *err,sword stat): mv_errtype(ORAERROR),status(stat),errcode(-1),errhp(0),message(err) { }
00031     
00032     OraError(const string &mess,ErrorType t): mv_errtype(t),status(0),errcode(-1),errhp(0),message(mess) {  }
00033     
00034     OraError(int err): mv_errtype(OCICPPERROR),status(0),errcode(-1),errhp(0),message("") {
00035         if(err==CELL_NULL) {
00036             message="OCICPP Error: Requested cell is null";
00037         } else if(err==CELL_NOT_EXISTS) {
00038             message="OCICPP Error: Requested cell is not exists";
00039         } else if(err==CELL_TYPE_UNSUPPORTED) {
00040             message="OCICPP Error: Requested cell is of unknown type";
00041         } else {
00042             message="OCICPP Error: unknown error";
00043         }
00044     }
00045         
00046     virtual ~OraError() {
00047       // intentionally left blank
00048     }
00049 
00050     ErrorType errtype () const throw ();
00051     virtual const char* what () const throw ();
00052 };
00053 
00054 } 
00055 #endif
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 

Generated at Tue Jun 12 10:37:29 2001 for OCI C++ Library by doxygen1.2.4-20010128 written by Dimitri van Heesch, © 1997-2001