#ifndef __SQLITE3INTERFACE_H_
#define __SQLITE3INTERFACE_H_

/************************************************************************/
/*	
	����: CSQLiter3Interface
	����: sqlite3���ݿ����
*/
/************************************************************************/

#include <string>

#ifndef _UNICODE
typedef std::string		TString;
#else
typedef wstring			TString;
#endif

struct sqlite3;

// ������,ע��:SQLite3ÿ��SQL������ʱ��Ҫ���Ϸֺ�;
#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
{
public:
	CSQLiter3Interface();
	~CSQLiter3Interface();

	//��
	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