1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #ifndef __SQLITE3INTERFACE_H_
- #define __SQLITE3INTERFACE_H_
- #include <string>
- #ifndef _UNICODE
- typedef std::string TString;
- #else
- typedef wstring TString;
- #endif
- struct sqlite3;
- #define CREATE_DB_TBL_ "create table remoteinfo(\
- [domain] text not null,\
- [shopname] text not null,\
- [ipaddr] text not null,\
- [pcname] text not null,\
- [sharedir] text not null,\
- PRIMARY KEY([domain]));"
- typedef struct _STRemoteInfo_
- {
- int bInUse;
- TCHAR szBranch[MAX_PATH];
- TCHAR szIP[MAX_PATH];
- TCHAR szDoMain[MAX_PATH];
- }STRemoteInfo,*pSTRemoteInfo;
- class CSQLiter3Interface
- {
- CSQLiter3Interface();
- public:
-
- ~CSQLiter3Interface();
- static CSQLiter3Interface* GetInstance()
- {
- static CSQLiter3Interface db;
- return &db;
- }
-
- int OpenSQLite3DB(const char* pDBPath);
-
- int CreateTabel(const char* pSql, CString& strError);
-
- int Exec(const char* pSql, CString& strError);
-
- const char* Get_ErrMsg();
-
- int Select(const char* pTableName, const char* pFields, const char* pLimit, std::vector<TString>& vValues, CString& strError);
-
- int Insert(const char* pTableName, const char* pFields, const char* pValues, CString& strError);
-
- int Delete(const char* pTableName, const char* pLimit, CString& strError);
-
- int Close();
- private:
- sqlite3* m_pSqli3db;
- };
- #endif
|