#ifndef _CERRORLOG_H #define _CERRORLOG_H #ifdef _WINDOWS64 #ifdef PUB_TOOLS_EXPORTS #define PUB_TOOLS_API __declspec(dllexport) #else #define PUB_TOOLS_API __declspec(dllimport) #endif #else #define PUB_TOOLS_API #endif #include #include #include #include #ifdef _WINDOWS64 #include #include #else #include #include #endif //#include "paramanage.h" #include "system.h" #include "db_com/wholepubtools.h" using namespace std; const int ONE_DAY_TIME = 24 * 60 * 60; const int MAX_ERROR_LOG_SIZE = 100; const int ERR_MAX_FILE_NAME = 255; const int ERR_MAX_PARA_NAME = 128; const string ERR_IN_DIR_SEPARATOR = "/in/"; const string ERR_OUT_DIR_SEPARATOR = "/out/"; //错误信息结构 struct TDbErrorMsg { int err_no; //DBAccess错误号 string dbaccess_err; //DBAccess错误信息 string db_err; //数据库错误信息 }; class PUB_TOOLS_API CErrorLog { private: time_t m_LastTime; time_t m_CurTime; string m_strFileName; bool m_bReCreateFile; int m_nFileNo; bool m_LogFlag; int m_nPid; string m_strPubPath; vector m_strDbNameVec; //所有数据库服务器名 time_t m_LastWriteFileTime; //最近一次写SQL语句文件的时间 public: CErrorLog(); ~CErrorLog(); int InitErrorLog(); int WriteErrorLog(string sql, vector err_vec, const string strpath, string strDbName = ""); int WriteLog(vector strLogVec, const string strpath); int WriteLog(string strLog, const string strpath); //zhangkeheng add for LOB int WriteErrorLog(string sql, string select_sql, vector err_vec, const string strpath); private: int GetTimeStringByTime_t(const time_t seconds, string &value_string) const; int CheckIfReCreateFile(); int GetPubPath(); string IntToStr(int nVal); }; #endif