00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __EXCEPTION_H__
00012 #define __EXCEPTION_H__
00013
00014 class FASTDB_DLL_ENTRY dbException
00015 {
00016 protected:
00017 int err_code;
00018 char* msg;
00019 int arg;
00020
00021 public:
00022 dbException(int p_err_code, char const* p_msg = NULL, int p_arg = 0)
00023 : err_code (p_err_code),
00024 msg (NULL),
00025 arg (p_arg)
00026 {
00027 if (p_msg != NULL) {
00028 msg = new char[strlen(p_msg)+1];
00029 strcpy(msg, p_msg);
00030 }
00031 }
00032
00033 dbException(dbException const& ex) {
00034 err_code = ex.err_code;
00035 arg = ex.arg;
00036 if (ex.msg != NULL) {
00037 msg = new char[strlen(ex.msg)+1];
00038 strcpy(msg, ex.msg);
00039 } else {
00040 msg = NULL;
00041 }
00042 }
00043
00044 ~dbException() {
00045 delete[] msg;
00046 }
00047
00048 int getErrCode() const { return err_code; }
00049 char* getMsg() const { return msg; }
00050 long getArg() const { return arg; }
00051 };
00052
00053 #endif