|
@@ -19,6 +19,199 @@ CWinApp theApp;
|
|
|
|
|
|
using namespace std;
|
|
using namespace std;
|
|
|
|
|
|
|
|
+void TEST_GetMidInfo()
|
|
|
|
+{
|
|
|
|
+ CSDK sdk;
|
|
|
|
+ STMid mid;
|
|
|
|
+ if ( sdk.DownloadMidData("IDL144240G") )
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ system("pause");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void TEST_InsertMidInfo()
|
|
|
|
+{
|
|
|
|
+ CDataImpl db;
|
|
|
|
+ if ( db.Open() )
|
|
|
|
+ {
|
|
|
|
+ STMid mid;
|
|
|
|
+ char szdata[10] = {0};
|
|
|
|
+ for ( int i = 0; i < 100; i++ )
|
|
|
|
+ {
|
|
|
|
+ _itoa_s(i, szdata, 10);
|
|
|
|
+ mid.order = szdata;
|
|
|
|
+ mid.ctype = szdata;
|
|
|
|
+ mid.version = "V8-SCBC098-LV1096";
|
|
|
|
+ mid.dsize = "100";
|
|
|
|
+ mid.number = "1000";
|
|
|
|
+ mid.pid = "102";
|
|
|
|
+ mid.pmd5 = "dfeqadfadfer546489er4adf";
|
|
|
|
+ mid.purl = "https://www.baidu.com";
|
|
|
|
+ db.InsertMidInfo(mid);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for ( int i = 0; i < 100; i++)
|
|
|
|
+ {
|
|
|
|
+ _itoa_s(i, szdata, 10);
|
|
|
|
+ db.UpdateKeyCopyStatus(szdata, 1);
|
|
|
|
+ if ( i%2 )
|
|
|
|
+ db.UpdateKeyReportStatus(szdata, 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void TEST_InertKeys()
|
|
|
|
+{
|
|
|
|
+ CDataImpl db;
|
|
|
|
+ if ( db.Open() )
|
|
|
|
+ {
|
|
|
|
+ STKeys keys;
|
|
|
|
+ char szdata[10] = {0};
|
|
|
|
+ db.TransactionBegin();
|
|
|
|
+ for ( int i = 0; i < 50000; i++ )
|
|
|
|
+ {
|
|
|
|
+ _itoa_s(i, szdata, 10);
|
|
|
|
+ keys.sn = szdata;
|
|
|
|
+ keys.keys = "{\"did\":\"did\",\"mac\":\"mac\",\"cikey\":\"cikey\",\"hdcp\":\"hdcp\",\"hdcp22\":\"hdcp22\",\"widi\":\"widi\",\"esn\":\"esn\",\"widevine\":\"widevine\"}";
|
|
|
|
+ db.InsertKeyInfo(keys);
|
|
|
|
+ }
|
|
|
|
+ db.TransactionCommit();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void TEST_InertKeys2()
|
|
|
|
+{
|
|
|
|
+ CDataImpl db;
|
|
|
|
+ if ( db.Open() )
|
|
|
|
+ {
|
|
|
|
+ char szdata[10] = {0};
|
|
|
|
+ OutputDebugString("批量插入数据\n");
|
|
|
|
+ OutputDebugString(CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S\n"));
|
|
|
|
+
|
|
|
|
+ std::vector<STKeys> vtKeys;
|
|
|
|
+ vtKeys.resize(200);
|
|
|
|
+ std::vector<STKeys>::iterator it = vtKeys.begin();
|
|
|
|
+ for ( int i = 0; it != vtKeys.end(); it++, i++ )
|
|
|
|
+ {
|
|
|
|
+ _itoa_s(i, szdata, 10);
|
|
|
|
+ it->pid = "1";
|
|
|
|
+ it->sn = szdata;
|
|
|
|
+ it->keys = "{\"did\":\"did\",\"mac\":\"mac\",\"cikey\":\"cikey\",\"hdcp\":\"hdcp\",\"hdcp22\":\"hdcp22\",\"widi\":\"widi\",\"esn\":\"esn\",\"widevine\":\"widevine\"}";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ OutputDebugString("开始批量插入数据\n");
|
|
|
|
+ OutputDebugString(CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S\n"));
|
|
|
|
+ db.BatchInsertKeyInfo(vtKeys);
|
|
|
|
+ OutputDebugString("完成批量插入数据\n");
|
|
|
|
+ OutputDebugString(CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S\n"));
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void TEST_InertLog()
|
|
|
|
+{
|
|
|
|
+ CDataImpl db;
|
|
|
|
+ if ( db.Open() )
|
|
|
|
+ {
|
|
|
|
+ STLog log;
|
|
|
|
+ char szdata[10] = {0};
|
|
|
|
+ db.TransactionBegin();
|
|
|
|
+ for ( int i = 0; i < 200; i++ )
|
|
|
|
+ {
|
|
|
|
+ _itoa_s(i, szdata, 10);
|
|
|
|
+ log.sn = szdata;
|
|
|
|
+ log.type = "1";
|
|
|
|
+ log.content = "测试内容:东方丽景散热地觚单位 加菲软糖加工厂饮用水";
|
|
|
|
+ if ( i%2 )
|
|
|
|
+ log.report_status = "1";
|
|
|
|
+ else
|
|
|
|
+ log.report_status = "0";
|
|
|
|
+ log.report_date = "";
|
|
|
|
+ db.InsertLogInfo(log);
|
|
|
|
+ }
|
|
|
|
+ db.TransactionCommit();
|
|
|
|
+
|
|
|
|
+ std::vector<STLog> vtLog;
|
|
|
|
+ db.QueryUnReportLogInfo(vtLog);
|
|
|
|
+ db.UpdateLogReportStatus("0", "1", 1);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void TEST_QueryMidInfo()
|
|
|
|
+{
|
|
|
|
+ CDataImpl db;
|
|
|
|
+ if ( db.Open() )
|
|
|
|
+ {
|
|
|
|
+ STMid mid;
|
|
|
|
+ db.QueryMidInfo("1", mid);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void TEST_QueryUnReportKey()
|
|
|
|
+{
|
|
|
|
+ CDataImpl db;
|
|
|
|
+ if ( db.Open() )
|
|
|
|
+ {
|
|
|
|
+ std::vector<STKeys> vtKeys;
|
|
|
|
+ db.QueryUnReportKeyInfo(vtKeys);
|
|
|
|
+ std::vector<STKeys>::iterator it = vtKeys.begin();
|
|
|
|
+ for (; it != vtKeys.end(); it++ )
|
|
|
|
+ {
|
|
|
|
+ OutputDebugString("SN:");
|
|
|
|
+ OutputDebugString(it->sn.c_str());
|
|
|
|
+ OutputDebugString("\t");
|
|
|
|
+
|
|
|
|
+ OutputDebugString("copy_date:");
|
|
|
|
+ OutputDebugString(it->copy_date.c_str());
|
|
|
|
+ OutputDebugString("\t");
|
|
|
|
+
|
|
|
|
+ OutputDebugString("copy_status:");
|
|
|
|
+ OutputDebugString(it->copy_status.c_str());
|
|
|
|
+ OutputDebugString("\t");
|
|
|
|
+
|
|
|
|
+ OutputDebugString("report_date:");
|
|
|
|
+ OutputDebugString(it->report_date.c_str());
|
|
|
|
+ OutputDebugString("\t");
|
|
|
|
+
|
|
|
|
+ OutputDebugString("report_status:");
|
|
|
|
+ OutputDebugString(it->report_status.c_str());
|
|
|
|
+ OutputDebugString("\n");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void TEST_QueryKeyInfo()
|
|
|
|
+{
|
|
|
|
+ CDataImpl db;
|
|
|
|
+ if ( db.Open() )
|
|
|
|
+ {
|
|
|
|
+ STKeys key;
|
|
|
|
+ db.QueryKeyInfo("1", key);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void TEST_QueryLogInfo()
|
|
|
|
+{
|
|
|
|
+ CDataImpl db;
|
|
|
|
+ if ( db.Open() )
|
|
|
|
+ {
|
|
|
|
+ STKeys log;
|
|
|
|
+ db.QueryKeyInfo("1", log);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void TEST_QueryUnReportLogInfo()
|
|
|
|
+{
|
|
|
|
+ CDataImpl db;
|
|
|
|
+ if ( db.Open() )
|
|
|
|
+ {
|
|
|
|
+ std::vector<STLog> vtlog;
|
|
|
|
+ db.QueryUnReportLogInfo(vtlog);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
|
|
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
|
|
{
|
|
{
|
|
int nRetCode = 0;
|
|
int nRetCode = 0;
|
|
@@ -34,120 +227,9 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
|
|
{
|
|
{
|
|
std::string md5 = GetFileMD5("D:\\bin\\scbc.tools\\scbc.tools.pdb");
|
|
std::string md5 = GetFileMD5("D:\\bin\\scbc.tools\\scbc.tools.pdb");
|
|
// TODO: 在此处为应用程序的行为编写代码。
|
|
// TODO: 在此处为应用程序的行为编写代码。
|
|
- CDataImpl db;
|
|
|
|
- if ( db.Open() )
|
|
|
|
- {
|
|
|
|
- STMid mid;
|
|
|
|
- char szdata[100] = {0};
|
|
|
|
- for ( int i = 0; i < 100; i++ )
|
|
|
|
- {
|
|
|
|
- _itoa_s(i, szdata, 10);
|
|
|
|
- mid.order = szdata;
|
|
|
|
- mid.ctype = szdata;
|
|
|
|
- mid.version = "V8-SCBC098-LV1096";
|
|
|
|
- mid.dsize = "100";
|
|
|
|
- mid.number = "1000";
|
|
|
|
- mid.pid = "102";
|
|
|
|
- mid.pmd5 = "dfeqadfadfer546489er4adf";
|
|
|
|
- mid.purl = "https://www.baidu.com";
|
|
|
|
- db.InsertMidInfo(mid);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- db.QueryMidInfo("1", mid);
|
|
|
|
- OutputDebugString("查询描述:");
|
|
|
|
- OutputDebugString(mid.des.c_str());
|
|
|
|
- OutputDebugString("\n");
|
|
|
|
|
|
+ TEST_GetMidInfo();
|
|
|
|
|
|
-#if 0
|
|
|
|
- STKeys keys;
|
|
|
|
- db.TransactionBegin();
|
|
|
|
- for ( int i = 0; i < 50000; i++ )
|
|
|
|
- {
|
|
|
|
- _itoa_s(i, szdata, 10);
|
|
|
|
- keys.sn = szdata;
|
|
|
|
- keys.keys = "{\"did\":\"did\",\"mac\":\"mac\",\"cikey\":\"cikey\",\"hdcp\":\"hdcp\",\"hdcp22\":\"hdcp22\",\"widi\":\"widi\",\"esn\":\"esn\",\"widevine\":\"widevine\"}";
|
|
|
|
- db.InsertKeyInfo(keys);
|
|
|
|
- }
|
|
|
|
- db.TransactionCommit();
|
|
|
|
-#else
|
|
|
|
- OutputDebugString("批量插入数据\n");
|
|
|
|
- OutputDebugString(CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S\n"));
|
|
|
|
- std::vector<STKeys> vtKeys;
|
|
|
|
- vtKeys.resize(200);
|
|
|
|
- std::vector<STKeys>::iterator it = vtKeys.begin();
|
|
|
|
- for ( int i = 0; it != vtKeys.end(); it++, i++ )
|
|
|
|
- {
|
|
|
|
- _itoa_s(i, szdata, 10);
|
|
|
|
- it->order = "1";
|
|
|
|
- it->sn = szdata;
|
|
|
|
- it->keys = "{\"did\":\"did\",\"mac\":\"mac\",\"cikey\":\"cikey\",\"hdcp\":\"hdcp\",\"hdcp22\":\"hdcp22\",\"widi\":\"widi\",\"esn\":\"esn\",\"widevine\":\"widevine\"}";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- OutputDebugString("开始批量插入数据\n");
|
|
|
|
- OutputDebugString(CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S\n"));
|
|
|
|
- db.BatchInsertKeyInfo(vtKeys);
|
|
|
|
- OutputDebugString("完成批量插入数据\n");
|
|
|
|
- OutputDebugString(CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S\n"));
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
- for ( int i = 0; i < 100; i++)
|
|
|
|
- {
|
|
|
|
- _itoa_s(i, szdata, 10);
|
|
|
|
- db.UpdateKeyCopyStatus(szdata, 1);
|
|
|
|
- if ( i%2 )
|
|
|
|
- db.UpdateKeyReportStatus(szdata, 1);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- vtKeys.clear();
|
|
|
|
- db.QueryUnReportKeyInfo(vtKeys);
|
|
|
|
- it = vtKeys.begin();
|
|
|
|
- for (; it != vtKeys.end(); it++ )
|
|
|
|
- {
|
|
|
|
- OutputDebugString("SN:");
|
|
|
|
- OutputDebugString(it->sn.c_str());
|
|
|
|
- OutputDebugString("\t");
|
|
|
|
-
|
|
|
|
- OutputDebugString("copy_date:");
|
|
|
|
- OutputDebugString(it->copy_date.c_str());
|
|
|
|
- OutputDebugString("\t");
|
|
|
|
-
|
|
|
|
- OutputDebugString("copy_status:");
|
|
|
|
- OutputDebugString(it->copy_status.c_str());
|
|
|
|
- OutputDebugString("\t");
|
|
|
|
-
|
|
|
|
- OutputDebugString("report_date:");
|
|
|
|
- OutputDebugString(it->report_date.c_str());
|
|
|
|
- OutputDebugString("\t");
|
|
|
|
-
|
|
|
|
- OutputDebugString("report_status:");
|
|
|
|
- OutputDebugString(it->report_status.c_str());
|
|
|
|
- OutputDebugString("\n");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-#if 1
|
|
|
|
- STLog log;
|
|
|
|
- db.TransactionBegin();
|
|
|
|
- for ( int i = 0; i < 200; i++ )
|
|
|
|
- {
|
|
|
|
- _itoa_s(i, szdata, 10);
|
|
|
|
- log.sn = szdata;
|
|
|
|
- log.type = "1";
|
|
|
|
- log.content = "测试内容:东方丽景散热地觚单位 加菲软糖加工厂饮用水";
|
|
|
|
- if ( i%2 )
|
|
|
|
- log.report_status = "1";
|
|
|
|
- else
|
|
|
|
- log.report_status = "0";
|
|
|
|
- log.report_date = "";
|
|
|
|
- db.InsertLogInfo(log);
|
|
|
|
- }
|
|
|
|
- db.TransactionCommit();
|
|
|
|
-
|
|
|
|
- std::vector<STLog> vtLog;
|
|
|
|
- db.QueryUnReportLogInfo(vtLog);
|
|
|
|
-
|
|
|
|
- db.UpdateLogReportStatus("0", "1", 1);
|
|
|
|
-#endif
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
return nRetCode;
|
|
return nRetCode;
|