Эх сурвалжийг харах

数据库结构体封装;

Jeff 5 жил өмнө
parent
commit
f5f18aeebc

+ 112 - 50
scbc.tools/scbc.tools/DataImpl.cpp

@@ -3,20 +3,22 @@
 #include "CharEncoding.h"
 #include "Global.h"
 
+#define FREE_MSG if ( m_pszErrmsg ) { sqlite3_free(m_pszErrmsg); m_pszErrmsg = NULL;}
+
 CDataImpl::CDataImpl(void):m_psqlite3(NULL),m_pszErrmsg(NULL)
 {
 }
 
 CDataImpl::~CDataImpl(void)
 {
+	Close();
 }
 
 BOOL CDataImpl::Open()
 {
 	Close();
 	CHAR szpath[MAX_PATH] = {0};
-	_stprintf_s(szpath, _T("%ssms.db"), Global::g_szCurModuleDir );
-
+	_stprintf_s(szpath, _T("%ssms.db"), Global::g_szCurModuleDir);
 	std::string strPath;
 	if ( !CharEncoding::ASCII2UTF8(szpath,strPath))
 	{
@@ -27,6 +29,25 @@ BOOL CDataImpl::Open()
 	if ( nResult != SQLITE_OK )
 		return FALSE;
 
+	// 创建表;
+	if ( !QueryTable("MID"))
+	{
+		sqlite3_exec(m_psqlite3, _CREATE_MID_TABLE_, NULL, NULL, &m_pszErrmsg);
+		FREE_MSG
+	}
+
+	if ( !QueryTable("KeyCopy"))
+	{
+		sqlite3_exec(m_psqlite3, _CREATE_KC_TABLE_, NULL, NULL, &m_pszErrmsg);
+		FREE_MSG
+	}
+
+	if ( !QueryTable("Log"))
+	{
+		sqlite3_exec(m_psqlite3, _CREATE_LOG_TABLE_, NULL, NULL, &m_pszErrmsg);
+		FREE_MSG
+	}
+
 	return TRUE;
 }
 
@@ -36,6 +57,9 @@ void CDataImpl::Close()
 		sqlite3_close(m_psqlite3);
 
 	m_psqlite3 = NULL;
+	if ( m_pszErrmsg )
+		sqlite3_free(m_pszErrmsg);
+	m_pszErrmsg = NULL;
 }
 
 BOOL CDataImpl::ExecteSQL(IN LPCSTR lpSQL)
@@ -54,13 +78,45 @@ BOOL CDataImpl::ExecteSQL(IN LPCSTR lpSQL)
 	if(SQLITE_OK != sqlite_error)
 	{
 		//Global::WriteTextLog(_T("ExecteSQL:%s"), psqlite_error);
+		FREE_MSG
 		return FALSE;
 	}
 
 	return TRUE;
 }
 
-INT CDataImpl::QueryContactsType(IN OUT std::vector<STContactsType> &vtContactsType)
+BOOL CDataImpl::QueryTable(std::string table)
+{
+	if ( table.size() == 0 )
+	{
+		//Global::WriteTextLog(_T("ExecteSQL:执行语句空!"));
+		return FALSE;
+	}
+
+	if(m_psqlite3 == NULL)
+		return FALSE;
+
+	INT nRow = 0;
+	INT nCol = 0;
+
+	char** pazResult = NULL;
+	char szSql[MAX_PATH] = {0};
+	_stprintf_s(szSql, _T("select * from sqlite_master where type = 'table' and name = '%s'"), table.c_str());
+	int sqlite_error = sqlite3_get_table(m_psqlite3, szSql, &pazResult, &nRow, &nCol, &m_pszErrmsg);
+	if ( sqlite_error != SQLITE_OK)
+	{
+		//Global::WriteTextLog(_T("QueryContactsType:%s"), m_pszErrmsg);
+		FREE_MSG
+		return FALSE;
+	}
+
+	sqlite3_free_table(pazResult);
+
+	return nRow != 0;
+}
+
+
+INT CDataImpl::QueryMidInfo(std::string order, STMid &data)
 {
 	if ( m_psqlite3 == NULL )
 		return -1;
@@ -69,26 +125,44 @@ INT CDataImpl::QueryContactsType(IN OUT std::vector<STContactsType> &vtContactsT
 	INT nCol = 0;
 
 	char** pazResult = NULL;
-	int sqlite_error = sqlite3_get_table(m_psqlite3, "select Autoid, ContactsType from ContactsType", &pazResult, &nRow, &nCol, &m_pszErrmsg);
+	int sqlite_error = sqlite3_get_table(m_psqlite3, _SELECT_MID_TABLE_, &pazResult, &nRow, &nCol, &m_pszErrmsg);
 	if ( sqlite_error != SQLITE_OK)
 	{
 		//Global::WriteTextLog(_T("QueryContactsType:%s"), m_pszErrmsg);
+		FREE_MSG
 		return -1;
 	}
 
-	for(int i = 1; i <= nRow; i++)
+	if( nRow == 1)
 	{
-		STContactsType tagObj;
 #ifndef USE_UTF8
-		tagObj.strAutoid = pazResult[i*nCol + 0];
-		tagObj.strContactsType = pazResult[i*nCol + 1];
+		data.order = pazResult[nCol+0];
+		data.number = pazResult[nCol+1];
+		data.pid = pazResult[nCol+2];
+		data.ctype = pazResult[nCol+3];
+		data.version = pazResult[nCol+4];
+		data.purl = pazResult[nCol+5];
+		data.psize = pazResult[nCol+6];
+		data.pmd5 = pazResult[nCol+7];
+		data.status = pazResult[nCol+8];
+		data.start_date = pazResult[nCol+9];
+		data.finish_date = pazResult[nCol+10];
+		data.des = pazResult[nCol+11];
 #else
 		// 由Native for SQLite3插入的数据,都是utf8格式;
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 0], tagObj.strAutoid);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 1], tagObj.strContactsType);
+		data.order = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
+		data.number = pazResult[nCol+1];
+		data.pid = pazResult[nCol+2];
+		data.ctype = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
+		data.version = CharEncoding::UTF82ASCII(pazResult[nCol+4]);
+		data.purl = CharEncoding::UTF82ASCII(pazResult[nCol+5]);
+		data.psize = pazResult[nCol+6];
+		data.pmd5 = CharEncoding::UTF82ASCII(pazResult[nCol+7]);
+		data.status = pazResult[nCol+8];
+		data.start_date = CharEncoding::UTF82ASCII(pazResult[nCol+9]);
+		data.finish_date = CharEncoding::UTF82ASCII(pazResult[nCol+10]);
+		data.des = CharEncoding::UTF82ASCII(pazResult[nCol+11]);
 #endif
-
-		vtContactsType.push_back(tagObj);
 	}
 
 	sqlite3_free_table(pazResult);
@@ -96,7 +170,7 @@ INT CDataImpl::QueryContactsType(IN OUT std::vector<STContactsType> &vtContactsT
 	return nRow;
 }
 
-INT CDataImpl::QueryContactsInfo(IN OUT std::vector<STContactsInfo> &vtContactsInfo)
+INT CDataImpl::QueryKeyInfo(std::string sn, STKeyCopy &data)
 {
 	if ( m_psqlite3 == NULL )
 		return -1;
@@ -105,33 +179,31 @@ INT CDataImpl::QueryContactsInfo(IN OUT std::vector<STContactsInfo> &vtContactsI
 	INT nCol = 0;
 
 	char** pazResult = NULL;
-	int sqlite_error = sqlite3_get_table(m_psqlite3, "select Autoid, ContactsType, ContactsName,ContactsPhone, ContactsStatus from ContactsInfo", &pazResult, &nRow, &nCol, &m_pszErrmsg);
+	int sqlite_error = sqlite3_get_table(m_psqlite3, _SELECT_KC_TABLE_, &pazResult, &nRow, &nCol, &m_pszErrmsg);
 	if ( sqlite_error != SQLITE_OK)
 	{
 		//Global::WriteTextLog(_T("QueryContactsInfo:%s"), m_pszErrmsg);
 		return -1;
 	}
 
-	for(int i = 1; i <= nRow; i++)
+	if ( nRow == 1)
 	{
-		STContactsInfo tagObj;
-
 #ifndef USE_UTF8
-		tagObj.strAutoid = pazResult[i*nCol + 0];
-		tagObj.strContactsType = pazResult[i*nCol + 1];
-		tagObj.strContactsName = pazResult[i*nCol + 2];
-		tagObj.strContactsPhone = pazResult[i*nCol + 3];
-		tagObj.strContactsStatus = pazResult[i*nCol + 4];
+		data.sn = pazResult[nCol+0];
+		data.keys = pazResult[nCol+1];
+		data.copy_date = pazResult[nCol+2];
+		data.report_date = pazResult[nCol+3];
+		data.copy_status = pazResult[nCol+4];
+		data.report_status = pazResult[nCol+5];
 #else
 		// 由Native for SQLite3插入的数据,都是utf8格式;
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 0], tagObj.strAutoid);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 1], tagObj.strContactsType);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 2], tagObj.strContactsName);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 3], tagObj.strContactsPhone);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 4], tagObj.strContactsStatus);
+		data.sn = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
+		data.keys = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
+		data.copy_date = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
+		data.report_date = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
+		data.copy_status = pazResult[nCol+4];
+		data.report_status = pazResult[nCol+5];
 #endif
-
-		vtContactsInfo.push_back(tagObj);
 	}
 
 	sqlite3_free_table(pazResult);
@@ -139,7 +211,7 @@ INT CDataImpl::QueryContactsInfo(IN OUT std::vector<STContactsInfo> &vtContactsI
 	return nRow;
 }
 
-INT CDataImpl::QueryTaskInfo(IN OUT std::vector<STTaskInfo> &vtTaskInfo)
+INT CDataImpl::QueryLogInfo(std::string sn, STLog &data)
 {
 	if ( m_psqlite3 == NULL )
 		return -1;
@@ -148,37 +220,25 @@ INT CDataImpl::QueryTaskInfo(IN OUT std::vector<STTaskInfo> &vtTaskInfo)
 	INT nCol = 0;
 
 	char** pazResult = NULL;
-	int sqlite_error = sqlite3_get_table(m_psqlite3, "select Autoid,TirrgerTime, TaskPhone, TaskContent, ExecDate, TaskStatus, TirrgerCycle from TaskInfo", &pazResult, &nRow, &nCol, &m_pszErrmsg);
+	int sqlite_error = sqlite3_get_table(m_psqlite3, _SELECT_LOG_TABLE_, &pazResult, &nRow, &nCol, &m_pszErrmsg);
 	if ( sqlite_error != SQLITE_OK)
 	{
 		//Global::WriteTextLog(_T("QueryTaskInfo:%s"), m_pszErrmsg);
 		return -1;
 	}
 
-	for(int i = 1; i <= nRow; i++)
+	if ( nRow == 1 )
 	{
-		STTaskInfo tagObj;
-
 #ifndef USE_UTF8
-		tagObj.strAutoid = pazResult[i*nCol + 0];
-		tagObj.strTirrgerTime = pazResult[i*nCol + 1];
-		tagObj.strTaskPhone = pazResult[i*nCol + 2];
-		tagObj.strTaskContent = pazResult[i*nCol + 3];
-		tagObj.strExecDate = pazResult[i*nCol + 4];
-		tagObj.strTaskStatus = pazResult[i*nCol + 5];
-		tagObj.strTirrgerCycle = pazResult[i*nCol + 6];
+		data.type = pazResult[nCol+0];
+		data.sn = pazResult[nCol+1];
+		data.content = pazResult[nCol+2];
 #else
 		// 由Native for SQLite3插入的数据,都是utf8格式;
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 0], tagObj.strAutoid);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 1], tagObj.strTirrgerTime);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 2], tagObj.strTaskPhone);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 3], tagObj.strTaskContent);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 4], tagObj.strExecDate);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 5], tagObj.strTaskStatus);
-		CharEncoding::UTF82ASCII(pazResult[i*nCol + 6], tagObj.strTirrgerCycle);
+		data.type = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
+		data.sn = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
+		data.content = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
 #endif
-
-		vtTaskInfo.push_back(tagObj);
 	}
 
 	sqlite3_free_table(pazResult);
@@ -186,6 +246,7 @@ INT CDataImpl::QueryTaskInfo(IN OUT std::vector<STTaskInfo> &vtTaskInfo)
 	return nRow;
 }
 
+#if 0
 INT CDataImpl::QuerySendRecord(IN OUT std::vector<STSendRecord> &vtSendRecord)
 {
 	if ( m_psqlite3 == NULL )
@@ -944,3 +1005,4 @@ BOOL CDataImpl::ClearnTaskStatus(IN LPCSTR lpAutoid)
 
 	return TRUE;
 }
+#endif

+ 36 - 13
scbc.tools/scbc.tools/DataImpl.h

@@ -25,19 +25,20 @@
 
 class CDataImpl
 {
-	CDataImpl(void);
+	//CDataImpl(void);
 public:
-	static CDataImpl* GetInstance()
-	{
-		static CDataImpl *pObj = NULL;
-		if ( pObj == NULL )
-		{
-			pObj = new CDataImpl;
-			pObj->Open();
-		}
-
-		return pObj;
-	}
+	CDataImpl(void);
+// 	static CDataImpl* GetInstance()
+// 	{
+// 		static CDataImpl *pObj = NULL;
+// 		if ( pObj == NULL )
+// 		{
+// 			pObj = new CDataImpl;
+// 			pObj->Open();
+// 		}
+// 
+// 		return pObj;
+// 	}
 
 	virtual ~CDataImpl(void);
 
@@ -58,16 +59,37 @@ public:
 		return ( nRet == 0 ) ? TRUE : FALSE;
 	}
 
+	// commit;
 	BOOL TransactionCommit()
 	{
 		INT nRet = sqlite3_exec(m_psqlite3, "commit", 0, 0, &m_pszErrmsg);
 		return ( nRet == 0 ) ? TRUE : FALSE;
 	}
 
-	// commit;
 	// 执行语句;
 	BOOL ExecteSQL(IN LPCSTR lpSQL);
+	// 查询表是否存在;
+	BOOL QueryTable(std::string table);
+
+	// 根据订单号查询订单信息;
+	INT QueryMidInfo(std::string order, STMid &data);
+	INT QueryKeyInfo(std::string sn, STKeyCopy &data);
+	INT QueryLogInfo(std::string sn, STLog &data);
+
+	// 插入mid信息;
+	INT InsertMidInfo(STMid &data);
+	// 插入sn key信息;
+	INT InsertKeyInfo(STKeyCopy &data);
+	// 插入log;
+	INT InsertLogInfo(STLog &data);
 
+	// 更新下载状态;(成功时,更新完成时间)
+	INT UpdateDownloadStatus(std::string order, int status, std::string des = "" /*失败描述*/);
+	// 更新抄写状态;
+	INT UpdateCopyStatus(std::string sn, int status);
+	// 更新上报状态;
+	INT UpdateReportStatus(std::string sn, int status);
+#if 0
 	// 查询联系人分类表;
 	INT QueryContactsType(IN OUT std::vector<STContactsType> &vtContactsType);
 	// 查询联系人表;
@@ -104,6 +126,7 @@ public:
 
 	// 清除任务状态;
 	BOOL ClearnTaskStatus(IN LPCSTR lpAutoid);
+#endif
 };
 
 #endif

+ 21 - 11
scbc.tools/scbc.tools/Global.cpp

@@ -29,19 +29,29 @@ namespace Global
 
 	//////////////////////////////////////////////////////////////////////////
 	// 全局函数;
+	void Init()
+	{
+		TCHAR szDrive[_MAX_DRIVE] = { 0 };
+		TCHAR szDir[_MAX_DIR] = { 0 };
+		TCHAR szExt[_MAX_DIR] = { 0 };
+		::GetModuleFileName(NULL, g_szCurModulePath, sizeof(g_szCurModulePath) / sizeof(TCHAR));
+		_tsplitpath_s(g_szCurModulePath, szDrive, szDir, g_szFna, szExt);
+		_tcscpy_s(g_szCurModuleDir, szDrive);
+		_tcscat_s(g_szCurModuleDir, szDir);
+	}
 	/************************************************************************/
 	/*  函数:WriteTextLog[7/28/2009 Jeff];
-			/*  描述:写文本日志;
-			/*  参数:;
-			/*  	[IN] :;
-			/*  返回:void;
-			/*  注意:;
-			/*  示例:;
-			/*
-			/*  修改:;
-			/*  日期:;
-			/*  内容:;
-			/************************************************************************/
+	/*  描述:写文本日志;
+	/*  参数:;
+	/*  	[IN] :;
+	/*  返回:void;
+	/*  注意:;
+	/*  示例:;
+	/*
+	/*  修改:;
+	/*  日期:;
+	/*  内容:;
+	/************************************************************************/
 	void WriteTextLog(const TCHAR* format, ...)
 	{
 		// 将日志内容输入到文件中;

+ 1 - 0
scbc.tools/scbc.tools/Global.h

@@ -284,6 +284,7 @@ namespace Global
 
 	//////////////////////////////////////////////////////////////////////////
 	// È«¾Öº¯Êý;
+	void Init();
 	void GetConfig();
 	void SetConfig();
 	bool GetVersion(IN const TCHAR* fname, OUT WORD* pdwFileVersion, OUT WORD* pdwProductVerion);

+ 66 - 36
scbc.tools/scbc.tools/TableInfo.h

@@ -1,46 +1,76 @@
 #ifndef __TABLE_INFO__
 #define __TABLE_INFO__
 
-// 联系类型表;
-typedef struct	__ST_CONTACTS_TYPE__
-{
-	std::string		strAutoid;						// id;
-	std::string		strContactsType;				// 联系人类型;
-}STContactsType, *pSTContactsType;
+// MID表;
+#define _CREATE_MID_TABLE_ \
+"CREATE TABLE MID \
+(bid  TEXT(16) NOT NULL,\
+number  INTEGER NOT NULL,\
+pid  INTEGER NOT NULL,\
+ctype  TEXT(32) NOT NULL,\
+version  TEXT(32) NOT NULL,\
+purl  TEXT NOT NULL,\
+psize  INTEGER NOT NULL,\
+pmd5  TEXT(32) NOT NULL,\
+status  INTEGER NOT NULL DEFAULT 0,\
+start_date  DATETIME DEFAULT current_timestamp,\
+finish_date  DATETIME DEFAULT '',\
+des  TEXT NULL DEFAULT '',\
+PRIMARY KEY (bid ASC));"
+#define _SELECT_MID_TABLE_ "select bid, number, pid, ctype, version, purl, psize, pmd5, status, start_date, finish_date, des from MID"
 
-// 联系人表;
-typedef struct __ST_CONTACTS_INFO__
-{
-	std::string		strAutoid;						// id;
-	std::string		strContactsType;				// 联系人类型;
-	std::string		strContactsName;				// 联系人姓名;
-	std::string		strContactsPhone;				// 联系人手机;
-	std::string		strContactsStatus;				// 联系人状态;
-}STContactsInfo, *pSTContactsInfo;
+// KeyCopy表;
+#define _CREATE_KC_TABLE_ \
+"CREATE TABLE KeyCopy \
+(sn  TEXT(32) PRIMARY KEY NOT NULL,\
+keys  TEXT NOT NULL,\
+copy_date  DATETIME DEFAULT '',\
+report_date  DATETIME DEFAULT '',\
+copy_status  INTEGER NOT NULL DEFAULT 0,\
+report_status  INTEGER NOT NULL DEFAULT 0);"
+#define _SELECT_KC_TABLE_ "select sn, keys, copy_date, report_date, copy_status, report_status from KeyCopy"
 
-// 任务表;
-typedef struct __ST_TASK_INFO__
+// Log表;
+#define _CREATE_LOG_TABLE_ \
+"CREATE TABLE Log \
+(type  TEXT(32) NOT NULL,\
+sn  TEXT NOT NULL,\
+content  TEXT NOT NULL);"
+#define _SELECT_LOG_TABLE_ "select type, sn, content from Log"
+
+// 订单下载表;
+typedef struct	__ST_MID__
 {
-	std::string		strAutoid;						// id;
-	std::string		strTirrgerCycle;				// 触发周期;		
-	std::string		strTirrgerTime;					// 触发时间;
-	std::string		strTaskPhone;					// 任务手机;
-	std::string		strTaskContent;					// 任务内容;
-	std::string		strExecDate;					// 执行日期;
-	std::string		strTaskStatus;					// 任务状态;
-}STTaskInfo, *pSTTaskInfo;
+	std::string		order;							// 订单号;
+	std::string		number;							// 订单数量;
+	std::string		pid;							// pid;
+	std::string		ctype;							// client type;
+	std::string		version;						// 软件版本;
+	std::string		purl;							// 包地址;
+	std::string		psize;							// 包大小;
+	std::string		pmd5;							// 包md5;
+	std::string		status;							// 下载状态:完成、未完成;
+	std::string		start_date;						// 下载开始时间;
+	std::string		finish_date;					// 下载完成时间;
+	std::string		des;							// 状态描述:下载失败原因;
+}STMid, *pSTMid;
 
-// 发送记录表;
-typedef struct __ST_SEND_RECORD__
+// 抄写表;
+typedef struct __ST_KEYCOPY__
 {
-	std::string		strAutoid;						// id;
-	std::string		strSendId;						// 短信id;
-	std::string		strSendDateTime;				// 发送日期时间;
-	std::string		strSendPhone;					// 发送手机;
-	std::string		strSendContent;					// 发送内容;
-	std::string		strSendResult;					// 发送结果;
-	std::string		strSendLog;						// 发送日志;
-	std::string		strSendType;					// 发送类型;
-}STSendRecord, *pSTSendRecord;
+	std::string		sn;								// sn;
+	std::string		keys;							// key包Json字符串;
+	std::string		copy_date;						// 抄写成功时间;
+	std::string		report_date;					// 上报时间;
+	std::string		copy_status;					// 抄写状态:未抄写、抄写成失败、抄写成功;
+	std::string		report_status;					// 上报状态:未上报、上报成功;
+}STKeyCopy, *pSTKeyCopy;
 
+// 日志表;
+typedef struct __ST_LOG__
+{
+	std::string		type;							// 日志类型;
+	std::string		sn;								// 关联的sn;		
+	std::string		content;						// 日志内容;
+}STLog, *pSTLog;
 #endif

+ 12 - 10
scbc.tools/scbc.tools/scbc.tools.cpp

@@ -4,6 +4,8 @@
 #include "stdafx.h"
 #include "scbc.tools.h"
 #include "CurlClient.h"
+#include "DataImpl.h"
+#include "Global.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -19,7 +21,7 @@ using namespace std;
 int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 {
 	int nRetCode = 0;
-
+	Global::Init();
 	// 初始化 MFC 并在失败时显示错误
 	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
 	{
@@ -30,15 +32,15 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 	else
 	{
 		// TODO: 在此处为应用程序的行为编写代码。
-		std::string data;
-		CCurlClient curl;
-		curl.Initialize();
-		if ( curl.DownloadEx("https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe", "D:\\WeChatSetup.exe", 5000) )
-			printf("下载成功\n");
-		else
-			printf("下载失败\n");
-
-		system("pause");
+		STMid data;
+		//CDataImpl::GetInstance()->QueryMidInfo("1",data);
+		CDataImpl db;
+		if ( db.Open() )
+		{
+			//db.QueryMidInfo("1",data);
+		}
+	
+		//system("pause");
 	}
 
 	return nRetCode;

+ 8 - 8
scbc.tools/scbc.tools/scbc.tools.vcproj

@@ -62,7 +62,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="crypt32.lib ws2_32.lib winmm.lib wldap32.lib log4C.lib libcurld.lib libeay32.lib ssleay32.lib"
+				AdditionalDependencies="crypt32.lib ws2_32.lib winmm.lib wldap32.lib log4C.lib libcurld.lib libeay32.lib ssleay32.lib sqlite3d.lib"
 				LinkIncremental="2"
 				AdditionalLibraryDirectories="..\lib"
 				GenerateDebugInformation="true"
@@ -138,7 +138,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="crypt32.lib ws2_32.lib winmm.lib wldap32.lib log4C.lib libcurl.lib libeay32.lib ssleay32.lib"
+				AdditionalDependencies="crypt32.lib ws2_32.lib winmm.lib wldap32.lib log4C.lib libcurl.lib libeay32.lib ssleay32.lib sqlite3.lib"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\lib"
 				GenerateDebugInformation="true"
@@ -196,7 +196,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\cJson;..\filehelper;..\Include;..\Log4C"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SCBCTOOLS_EXPORTS;LOG4C_ENABLE;CURL_STATICLIB"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SCBCTOOLS_EXPORTS;LOG4C_ENABLE;CURL_STATICLIB;TEST_MODE;USE_UTF8"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -215,7 +215,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="crypt32.lib ws2_32.lib winmm.lib wldap32.lib log4C.lib libcurld.lib libeay32.lib ssleay32.lib"
+				AdditionalDependencies="crypt32.lib ws2_32.lib winmm.lib wldap32.lib log4C.lib libcurld.lib libeay32.lib sqlite3d.lib ssleay32.lib"
 				LinkIncremental="2"
 				AdditionalLibraryDirectories="..\lib"
 				GenerateDebugInformation="true"
@@ -357,10 +357,6 @@
 				RelativePath=".\CharEncoding.h"
 				>
 			</File>
-			<File
-				RelativePath=".\CritSection.h"
-				>
-			</File>
 			<File
 				RelativePath=".\CurlClient.cpp"
 				>
@@ -409,6 +405,10 @@
 		<Filter
 			Name="sqlite3"
 			>
+			<File
+				RelativePath=".\CritSection.h"
+				>
+			</File>
 			<File
 				RelativePath=".\DataImpl.cpp"
 				>

+ 0 - 1
scbc.tools/scbc.tools/stdafx.h

@@ -32,5 +32,4 @@
 #include "log4c.h"
 // sqlite3头;
 #include "sqlite3.h"
-#pragma comment(lib, "sqlite3.lib")
 // TODO: 在此处引用程序需要的其他头文件