/************************************************************************/ /* Copyright (C), 2016-2020, [IT], 保留所有权利; /* 模 块 名:; /* 描 述:; /* /* 版 本:[V]; /* 作 者:[IT]; /* 日 期:[9/20/2016]; /* /* /* 注 意:; /* /* 修改记录:[IT]; /* 修改日期:; /* 修改版本:; /* 修改内容:; /************************************************************************/ #ifndef __ODBCPTR_20160920__ #define __ODBCPTR_20160920__ //class CDatabase; #include "IWxAdoInterface.h" #include "CUniqueId.h" #pragma once class /*AFX_EXT_CLASS*/ CWxAdoImpl:public IWxAdoInterface { CWxAdoImpl(void); public: ~CWxAdoImpl(void); ULONG STDMETHODCALLTYPE AddRef( ); ULONG STDMETHODCALLTYPE Release( ); HRESULT STDMETHODCALLTYPE QueryInterface(REFIID refiid, void **ppvObject); // 获取实例指针; static CWxAdoImpl* GetInstance(){ if ( m_pInstance == NULL ) m_pInstance = new CWxAdoImpl; return m_pInstance; } private: volatile LONG m_nRef; volatile LONG m_nObjRef; // 单例实例; static CWxAdoImpl* m_pInstance; CUniqueId m_uniqueid; void SolveDBError( IN CONST DWORD &dwError, IN LPVOID pDBConn); //template BOOL GetFiedValue(IN _RecordsetPtr rst, IN LPCTSTR lpFiedName, T &value); public: // 初始化所有连接; DWORD InitializePool( IN LPCTSTR lpDBType, IN LPCTSTR lpDBSource, IN CONST DWORD &dwDBPort, IN LPCTSTR lpDBAccount, IN LPCTSTR lpPassWord, IN LPCTSTR lpDBName, IN CONST INT &nMinConn = 1, IN CONST INT &nMaxConn = 5 ); // 关闭所有连接; void ReleasePool(); BOOL ExecuteSQL( IN LPCTSTR lpExcuteSQL, IN CONST DWORD &dwTimeOut = 30000 ); BOOL IsUserExist( IN LPCTSTR lpPhone, IN LPCTSTR lpPassword, OUT LPVOID lpOutValue,IN CONST DWORD &dwTimeOut = 3000 ); INT QueryUserDetail(IN LPCTSTR lpPhone, IN LPVOID lpOutValue, IN CONST DWORD& dwTimeOut = 3000); BOOL AddCustomer(IN LPVOID lpCustomerInfo, IN CONST DWORD& dwTimeOut = 3000); BOOL AddType(IN LPVOID lpStudioInfo, IN CONST DWORD& dwTimeOut = 3000); BOOL AddReply(IN LPVOID lpStudioInfo, IN CONST DWORD& dwTimeOut = 3000); BOOL UpdateCustomer(IN LPVOID lpCustomerInfo, IN CONST DWORD& dwTimeOut = 3000); }; #endif