📄 oraerror.h
字号:
#ifndef __ORAERROR_H_
#define __ORAERROR_H_
#include "ocicpp.h"
#include <exception>
namespace OCICPP {
using std::string;
class OraError: public std::exception {
private:
ErrorType mv_errtype;
sword status;
sb4 errcode;
OCIError *errhp;
public:
string message;
public:
OraError(OCIError *err,sword stat): mv_errtype(ORAERROR),status(stat),errcode(-1),errhp(err),message ("OCICPP Lib Exception: ") {
text *error;
error=(text *)calloc(512,sizeof(text));
(void) OCIErrorGet((dvoid *)errhp, (ub4) 1, (text *) NULL, &errcode, error, 512, OCI_HTYPE_ERROR);
error[511]='\0';
message += (char *)error;
free(error);
}
OraError(const string &mess,ErrorType t): mv_errtype(t),status(0),errcode(-1),errhp(0),message(mess) { }
OraError(int err): mv_errtype(OCICPPERROR),status(0),errcode(-1),errhp(0),message("") {
if(err==CELL_NULL) {
message="OCICPP Error: Requested cell is null";
} else if(err==CELL_NOT_EXISTS) {
message="OCICPP Error: Requested cell is not exists";
} else if(err==CELL_TYPE_UNSUPPORTED) {
message="OCICPP Error: Requested cell is of unknown type";
} else {
message="OCICPP Error: unknown error";
}
}
virtual ~OraError() throw() {
// intentionally left blank
}
ErrorType errtype () const throw ();
virtual const char* what () const throw ();
};
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -