#pragma once //#pragma warning(disable:4251) #include <stdio.h> #include <windows.h> #include <mutex> #include <vector> #include <functional> #include "string.h" #include "CError.h" #include "sqlite3.h" #include "dt.h" #include "CppSQLite3.h" #ifdef DATABASEOPERATE_DLL #define DLL_DATABASEOPERATE_API __declspec(dllexport) #else #define DLL_DATABASEOPERATE_API #endif typedef std::function<void(string strDbName, string strTableName)> DataNoticeCallbackFun; namespace ns_db { typedef struct _TABLE_INFO_BASE { INT iNo_; _TABLE_INFO_BASE() { iNo_ = 100; } } TABLE_INFO_BASE; class DLL_DATABASEOPERATE_API CDataBaseOperate { private: bool m_bIsInit; static void* m_pContext; static void* m_pPubSocket; static VOID CALLBACK RecvDataChangNoticeProcess(PTP_CALLBACK_INSTANCE Instance, PVOID Parameter, PTP_WORK Work); protected: CDataBaseOperate(string sPathFile); ~CDataBaseOperate(); virtual LONG SaveDB() = 0; virtual LONG LoadDB() = 0; bool Open(); void Close(); CppSQLite3DB m_DB; std::string m_sPathFile = ""; //���ñ��Ļ������� LONG SetTableData(string strTableName, vector<TABLE_INFO_BASE>* vecDB, vector<TABLE_INFO_BASE>* vecTemp, bool bAppend = false); public: string GetDbName() { return m_sPathFile; }; //�������ݵ����ݿ� LONG SaveDataToDB(); //�����ݿ�������� LONG LoadDataByDB(); //���ݸ��ĺ�֪ͨ LONG DataChangNotice(string strTableName); //�������ݸ��ĺ��֪ͨ void RecvDataChangNotice(string strTableName, DataNoticeCallbackFun callBackFun); }; }