|
@@ -73,7 +73,7 @@ BOOL CDataImpl::Open()
|
|
|
{
|
|
|
Close();
|
|
|
TCHAR szpath[MAX_PATH] = {0};
|
|
|
- _stprintf_s(szpath, _T("%sdb\\scbc.db"), GLOBAL::g_szModulePath);
|
|
|
+ _stprintf_s(szpath, _T("%sdb\\ogc.db"), GLOBAL::g_szModulePath);
|
|
|
std::string strPath;
|
|
|
#ifdef _UNICODE
|
|
|
if ( !CharEncoding::UNICODE2UTF8(szpath,strPath))
|
|
@@ -90,24 +90,17 @@ BOOL CDataImpl::Open()
|
|
|
|
|
|
|
|
|
char* psqlite_error = NULL;
|
|
|
- if ( !QueryTable("mid"))
|
|
|
+ if ( !QueryTable("DebugOrder"))
|
|
|
{
|
|
|
- sqlite3_exec(m_psqlite3, _CREATE_MID_TABLE_, NULL, NULL, &psqlite_error);
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),_CREATE_MID_TABLE_, psqlite_error);
|
|
|
+ sqlite3_exec(m_psqlite3, _CREATE_ORDER_, NULL, NULL, &psqlite_error);
|
|
|
+ GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),_CREATE_ORDER_, psqlite_error);
|
|
|
FREE_MSG;
|
|
|
}
|
|
|
|
|
|
- if ( !QueryTable("keys"))
|
|
|
+ if ( !QueryTable("DebugSN"))
|
|
|
{
|
|
|
- sqlite3_exec(m_psqlite3, _CREATE_KEYS_TABLE_, NULL, NULL, &psqlite_error);
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),_CREATE_KEYS_TABLE_, psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
- }
|
|
|
-
|
|
|
- if ( !QueryTable("log"))
|
|
|
- {
|
|
|
- sqlite3_exec(m_psqlite3, _CREATE_LOG_TABLE_, NULL, NULL, &psqlite_error);
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),_CREATE_LOG_TABLE_, psqlite_error);
|
|
|
+ sqlite3_exec(m_psqlite3, _CREATE_SN_, NULL, NULL, &psqlite_error);
|
|
|
+ GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),_CREATE_SN_, psqlite_error);
|
|
|
FREE_MSG;
|
|
|
}
|
|
|
|
|
@@ -176,68 +169,89 @@ BOOL CDataImpl::QueryTable(std::string table)
|
|
|
return nRow != 0;
|
|
|
}
|
|
|
|
|
|
+INT CDataImpl::InsertOrder(const TB_ORDER &order)
|
|
|
+{
|
|
|
+ return InsertOrder(order.strOrder, order.strDeltaEType, order.strDeltaEValue, order.nMode);
|
|
|
+}
|
|
|
|
|
|
-INT CDataImpl::QueryMidInfo(std::string order, STMid &data)
|
|
|
+INT CDataImpl::InsertOrder(std::string strOrder, std::string strDeltaEType, std::string strDeltaEValue, int nMode)
|
|
|
{
|
|
|
- if ( m_psqlite3 == NULL )
|
|
|
+ if(m_psqlite3 == NULL)
|
|
|
return -1;
|
|
|
|
|
|
- INT nRow = 0;
|
|
|
- INT nCol = 0;
|
|
|
+ char szMode[8] = {0};
|
|
|
+ _itoa_s(nMode, szMode, 10);
|
|
|
+ std::string strInsert = "INSERT INTO DebugOrders(OrderID, DEType, DEValue, Mode) VALUES ('";
|
|
|
+ strInsert.append(strOrder);
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(strDeltaEType);
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(strDeltaEValue);
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(szMode);
|
|
|
+ strInsert.append("');");
|
|
|
|
|
|
- char** pazResult = NULL;
|
|
|
char* psqlite_error = NULL;
|
|
|
- std::string strSql = _SELECT_MID_TABLE_;
|
|
|
- strSql.append(" WHERE bid = '");
|
|
|
- strSql.append(order);
|
|
|
- strSql.append("';");
|
|
|
- int sqlite_error = sqlite3_get_table(m_psqlite3, strSql.c_str(), &pazResult, &nRow, &nCol, &psqlite_error);
|
|
|
- if ( sqlite_error != SQLITE_OK)
|
|
|
+ int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
+ if(SQLITE_OK != sqlite_error)
|
|
|
{
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strSql.c_str(), psqlite_error);
|
|
|
+ GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strInsert.c_str(), psqlite_error);
|
|
|
FREE_MSG;
|
|
|
- return -1;
|
|
|
}
|
|
|
|
|
|
- if( nRow == 1)
|
|
|
+ return sqlite_error;
|
|
|
+}
|
|
|
+
|
|
|
+INT CDataImpl::InsertSN(const TB_SN &sn_data)
|
|
|
+{
|
|
|
+ return InsertSN(sn_data.strOrder, sn_data.strLine, sn_data.strSN, sn_data.strStartTime, sn_data.strFinishedTime, sn_data.nElapsed, sn_data.nTestResult, sn_data.dDeltaAVGEValue, sn_data.strDetails);
|
|
|
+}
|
|
|
+
|
|
|
+INT CDataImpl::InsertSN(std::string strOrder, std::string strLine, std::string strSN, std::string strStartTime, std::string strFinishTime, int nElapsed, int nTestResult, DOUBLE dDeltaAVGEValue, std::string strDetails )
|
|
|
+{
|
|
|
+ if(m_psqlite3 == NULL)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ char szValue[16] = {0};
|
|
|
+ std::string strInsert = "INSERT INTO DebugSN(OrderID, Line, SN, StartTime, FinishTime, ElapsedTime, TestResult, DEAvgValue, Outcome) VALUES ('";
|
|
|
+ strInsert.append(strOrder);
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(strLine);
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(strSN);
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(strStartTime);
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(strFinishTime);
|
|
|
+
|
|
|
+ _itoa_s(nElapsed, szValue, 10);
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(szValue);
|
|
|
+
|
|
|
+ _itoa_s(nTestResult, szValue, 10);
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(szValue);
|
|
|
+
|
|
|
+ _gcvt_s(szValue, dDeltaAVGEValue, 3);
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(szValue);
|
|
|
+
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(strDetails);
|
|
|
+ strInsert.append("');");
|
|
|
+
|
|
|
+ char* psqlite_error = NULL;
|
|
|
+ int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
+ if(SQLITE_OK != sqlite_error)
|
|
|
{
|
|
|
-#ifndef USE_UTF8
|
|
|
- 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
|
|
|
-
|
|
|
- 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
|
|
|
+ GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strInsert.c_str(), psqlite_error);
|
|
|
+ FREE_MSG;
|
|
|
}
|
|
|
|
|
|
- sqlite3_free_table(pazResult);
|
|
|
-
|
|
|
- return nRow;
|
|
|
+ return sqlite_error;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-INT CDataImpl::QueryKeyInfo(std::string sn, STKeys &data)
|
|
|
+INT CDataImpl::QueryOrder(std::string strOrder, TB_ORDER &order)
|
|
|
{
|
|
|
if ( m_psqlite3 == NULL )
|
|
|
return -1;
|
|
@@ -247,9 +261,9 @@ INT CDataImpl::QueryKeyInfo(std::string sn, STKeys &data)
|
|
|
|
|
|
char** pazResult = NULL;
|
|
|
char* psqlite_error = NULL;
|
|
|
- std::string strSql = _SELECT_KEYS_TABLE_;
|
|
|
- strSql.append(" WHERE sn = '");
|
|
|
- strSql.append(sn);
|
|
|
+ std::string strSql = _SELECT_ORDER_;
|
|
|
+ strSql.append(" WHERE OrderID = '");
|
|
|
+ strSql.append(strOrder);
|
|
|
strSql.append("';");
|
|
|
int sqlite_error = sqlite3_get_table(m_psqlite3, strSql.c_str(), &pazResult, &nRow, &nCol, &psqlite_error);
|
|
|
if ( sqlite_error != SQLITE_OK)
|
|
@@ -259,14 +273,22 @@ INT CDataImpl::QueryKeyInfo(std::string sn, STKeys &data)
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- if ( nRow == 1)
|
|
|
+ if( nRow == 1)
|
|
|
{
|
|
|
- data.bid = pazResult[nCol+0];
|
|
|
- data.pid = pazResult[nCol+1];
|
|
|
- data.sn = pazResult[nCol+2];
|
|
|
- data.keys = pazResult[nCol+3];
|
|
|
- data.copy_date = pazResult[nCol+4];
|
|
|
- data.report_date = pazResult[nCol+5];
|
|
|
+#ifndef USE_UTF8
|
|
|
+ order.strOrder = pazResult[nCol+0];
|
|
|
+ order.strDeltaEType = pazResult[nCol+1];
|
|
|
+ order.strDeltaEValue = pazResult[nCol+2];
|
|
|
+ order.nMode = atoi(pazResult[nCol+3]);
|
|
|
+ order.strCreateTime = pazResult[nCol+4];
|
|
|
+#else
|
|
|
+
|
|
|
+ order.strOrder = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
|
|
|
+ order.strDeltaEType = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
|
|
|
+ order.strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
|
|
|
+ order.nMode = atoi(pazResult[nCol+3]);
|
|
|
+ order.strCreateTime = CharEncoding::UTF82ASCII(pazResult[nCol+4]);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
sqlite3_free_table(pazResult);
|
|
@@ -274,7 +296,7 @@ INT CDataImpl::QueryKeyInfo(std::string sn, STKeys &data)
|
|
|
return nRow;
|
|
|
}
|
|
|
|
|
|
-INT CDataImpl::QueryUnReportKeyInfo(std::vector<STKeys> &vtdata)
|
|
|
+INT CDataImpl::QueryOrders(std::vector<TB_ORDER> &vtOrders, std::string strBeginTime, std::string EndTime)
|
|
|
{
|
|
|
if ( m_psqlite3 == NULL )
|
|
|
return -1;
|
|
@@ -284,7 +306,12 @@ INT CDataImpl::QueryUnReportKeyInfo(std::vector<STKeys> &vtdata)
|
|
|
|
|
|
char** pazResult = NULL;
|
|
|
char* psqlite_error = NULL;
|
|
|
- std::string strSql = "SELECT sn,copy_date FROM keys WHERE copy_date <> '' and report_date = '' LIMIT 0,200";
|
|
|
+ std::string strSql = _SELECT_ORDER_;
|
|
|
+ strSql.append(" WHERE CreateTime >= '");
|
|
|
+ strSql.append(strBeginTime);
|
|
|
+ strSql.append("' AND CreateTime <= '");
|
|
|
+ strSql.append(EndTime);
|
|
|
+ strSql.append("';");
|
|
|
int sqlite_error = sqlite3_get_table(m_psqlite3, strSql.c_str(), &pazResult, &nRow, &nCol, &psqlite_error);
|
|
|
if ( sqlite_error != SQLITE_OK)
|
|
|
{
|
|
@@ -293,12 +320,24 @@ INT CDataImpl::QueryUnReportKeyInfo(std::vector<STKeys> &vtdata)
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- vtdata.resize(nRow);
|
|
|
- std::vector<STKeys>::iterator it = vtdata.begin();
|
|
|
+ vtOrders.resize(nRow);
|
|
|
+ std::vector<TB_ORDER>::iterator it = vtOrders.begin();
|
|
|
for(int i = 1; i <= nRow; i++, it++)
|
|
|
{
|
|
|
- it->sn = pazResult[i*nCol+0];
|
|
|
- it->copy_date= pazResult[i*nCol+1];
|
|
|
+#ifndef USE_UTF8
|
|
|
+ it->strOrder = pazResult[i*nCol+0];
|
|
|
+ it->strDeltaEType = pazResult[i*nCol+1];
|
|
|
+ it->strDeltaEValue = pazResult[i*nCol+2];
|
|
|
+ it->nMode = atoi(pazResult[i*nCol+3]);
|
|
|
+ it->strCreateTime = pazResult[i*nCol+4];
|
|
|
+#else
|
|
|
+
|
|
|
+ it->strOrder = CharEncoding::UTF82ASCII(pazResult[i*nCol+0]);
|
|
|
+ it->strDeltaEType = CharEncoding::UTF82ASCII(pazResult[i*nCol+1]);
|
|
|
+ it->strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[i*nCol+2]);
|
|
|
+ it->nMode = atoi(pazResult[i*nCol+3]);
|
|
|
+ it->strCreateTime = CharEncoding::UTF82ASCII(pazResult[i*nCol+4]);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
sqlite3_free_table(pazResult);
|
|
@@ -306,7 +345,7 @@ INT CDataImpl::QueryUnReportKeyInfo(std::vector<STKeys> &vtdata)
|
|
|
return nRow;
|
|
|
}
|
|
|
|
|
|
-INT CDataImpl::QueryLogInfo(std::string sn, STLog &data)
|
|
|
+INT CDataImpl::QuerySNData(std::string strSN, TB_SN &sn_data)
|
|
|
{
|
|
|
if ( m_psqlite3 == NULL )
|
|
|
return -1;
|
|
@@ -316,31 +355,41 @@ INT CDataImpl::QueryLogInfo(std::string sn, STLog &data)
|
|
|
|
|
|
char** pazResult = NULL;
|
|
|
char* psqlite_error = NULL;
|
|
|
- int sqlite_error = sqlite3_get_table(m_psqlite3, _SELECT_LOG_TABLE_, &pazResult, &nRow, &nCol, &psqlite_error);
|
|
|
+ std::string strSql = _SELECT_SN_;
|
|
|
+ strSql.append(" WHERE SN = '");
|
|
|
+ strSql.append(strSN);
|
|
|
+ strSql.append("';");
|
|
|
+ int sqlite_error = sqlite3_get_table(m_psqlite3, strSql.c_str(), &pazResult, &nRow, &nCol, &psqlite_error);
|
|
|
if ( sqlite_error != SQLITE_OK)
|
|
|
{
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),_SELECT_LOG_TABLE_, psqlite_error);
|
|
|
+ GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strSql.c_str(), psqlite_error);
|
|
|
FREE_MSG;
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- if ( nRow == 1 )
|
|
|
+ if ( nRow == 1)
|
|
|
{
|
|
|
#ifndef USE_UTF8
|
|
|
- data.type = pazResult[nCol+0];
|
|
|
- data.bid = pazResult[nCol+1];
|
|
|
- data.sn = pazResult[nCol+2];
|
|
|
- data.content = pazResult[nCol+3];
|
|
|
- data.gdate = pazResult[nCol+4];
|
|
|
- data.report_date = pazResult[nCol+5];
|
|
|
+ sn_data.strOrder = pazResult[nCol+0];
|
|
|
+ sn_data.strSN = pazResult[nCol+1];
|
|
|
+ sn_data.strLine = pazResult[nCol+2];
|
|
|
+ sn_data.strStartTime = pazResult[nCol+3];
|
|
|
+ sn_data.strFinishedTime = pazResult[nCol+4];
|
|
|
+ sn_data.nElapsed = atoi(pazResult[nCol+5]);
|
|
|
+ sn_data.nTestResult = atoi(pazResult[nCol+6]);
|
|
|
+ sn_data.dDeltaAVGEValue = atof(pazResult[nCol+7]);
|
|
|
+ sn_data.strDetails = pazResult[nCol+8];
|
|
|
#else
|
|
|
|
|
|
- data.type = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
|
|
|
- data.bid = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
|
|
|
- data.sn = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
|
|
|
- data.content = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
|
|
|
- data.gdate = pazResult[nCol+4];
|
|
|
- data.report_date = pazResult[nCol+5];
|
|
|
+ sn_data.strOrder = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
|
|
|
+ sn_data.strSN = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
|
|
|
+ sn_data.strLine = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
|
|
|
+ sn_data.strStartTime = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
|
|
|
+ sn_data.strFinishedTime = CharEncoding::UTF82ASCII(pazResult[nCol+4]);
|
|
|
+ sn_data.nElapsed = atoi(pazResult[nCol+5]);
|
|
|
+ sn_data.nTestResult = atoi(pazResult[nCol+6]);
|
|
|
+ sn_data.dDeltaAVGEValue = atof(pazResult[nCol+7]);
|
|
|
+ sn_data.strDetails = CharEncoding::UTF82ASCII(pazResult[nCol+8]);
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -349,7 +398,7 @@ INT CDataImpl::QueryLogInfo(std::string sn, STLog &data)
|
|
|
return nRow;
|
|
|
}
|
|
|
|
|
|
-INT CDataImpl::QueryUnReportLogInfo(std::vector<STLog> &vtdata)
|
|
|
+INT CDataImpl::QuerySNData(std::string strOrder, std::vector<TB_SN> &vtSNdata)
|
|
|
{
|
|
|
if ( m_psqlite3 == NULL )
|
|
|
return -1;
|
|
@@ -359,7 +408,10 @@ INT CDataImpl::QueryUnReportLogInfo(std::vector<STLog> &vtdata)
|
|
|
|
|
|
char** pazResult = NULL;
|
|
|
char* psqlite_error = NULL;
|
|
|
- std::string strSql = "SELECT type, bid, sn, content, gdate FROM log WHERE report_date = ''";
|
|
|
+ std::string strSql = _SELECT_SN_;
|
|
|
+ strSql.append(" WHERE OrderID = '");
|
|
|
+ strSql.append(strOrder);
|
|
|
+ strSql.append("';");
|
|
|
int sqlite_error = sqlite3_get_table(m_psqlite3, strSql.c_str(), &pazResult, &nRow, &nCol, &psqlite_error);
|
|
|
if ( sqlite_error != SQLITE_OK)
|
|
|
{
|
|
@@ -368,15 +420,32 @@ INT CDataImpl::QueryUnReportLogInfo(std::vector<STLog> &vtdata)
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- vtdata.resize(nRow);
|
|
|
- std::vector<STLog>::iterator it = vtdata.begin();
|
|
|
+ vtSNdata.resize(nRow);
|
|
|
+ std::vector<TB_SN>::iterator it = vtSNdata.begin();
|
|
|
for(int i = 1; i <= nRow; i++, it++)
|
|
|
{
|
|
|
- it->type = pazResult[i*nCol+0];
|
|
|
- it->bid= pazResult[i*nCol+1];
|
|
|
- it->sn= pazResult[i*nCol+2];
|
|
|
- it->content= pazResult[i*nCol+3];
|
|
|
- it->gdate= pazResult[i*nCol+4];
|
|
|
+#ifndef USE_UTF8
|
|
|
+ it->strOrder = pazResult[nCol*i+0];
|
|
|
+ it->strSN = pazResult[nCol*i+1];
|
|
|
+ it->strLine = pazResult[nCol*i+2];
|
|
|
+ it->strStartTime = pazResult[nCol*i+3];
|
|
|
+ it->strFinishedTime = pazResult[nCol*i+4];
|
|
|
+ it->nElapsed = atoi(pazResult[nCol*i+5]);
|
|
|
+ it->nTestResult = atoi(pazResult[nCol*i+6]);
|
|
|
+ it->dDeltaAVGEValue = atof(pazResult[nCol*i+7]);
|
|
|
+ it->strDetails = pazResult[nCol*i+8];
|
|
|
+#else
|
|
|
+
|
|
|
+ it->strOrder = CharEncoding::UTF82ASCII(pazResult[nCol*i+0]);
|
|
|
+ it->strSN = CharEncoding::UTF82ASCII(pazResult[nCol*i+1]);
|
|
|
+ it->strLine = CharEncoding::UTF82ASCII(pazResult[nCol*i+2]);
|
|
|
+ it->strStartTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+3]);
|
|
|
+ it->strFinishedTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+4]);
|
|
|
+ it->nElapsed = atoi(pazResult[nCol*i+5]);
|
|
|
+ it->nTestResult = atoi(pazResult[nCol*i+6]);
|
|
|
+ it->dDeltaAVGEValue = atof(pazResult[nCol*i+7]);
|
|
|
+ it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol*i+8]);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
sqlite3_free_table(pazResult);
|
|
@@ -384,7 +453,7 @@ INT CDataImpl::QueryUnReportLogInfo(std::vector<STLog> &vtdata)
|
|
|
return nRow;
|
|
|
}
|
|
|
|
|
|
-INT CDataImpl::QueryBidInfo(std::string order, BidInfo& binfo)
|
|
|
+INT CDataImpl::QuerySNData(std::vector<TB_SN> &vtSNData, std::string strBeginTime, std::string EndTime)
|
|
|
{
|
|
|
if ( m_psqlite3 == NULL )
|
|
|
return -1;
|
|
@@ -394,22 +463,46 @@ INT CDataImpl::QueryBidInfo(std::string order, BidInfo& binfo)
|
|
|
|
|
|
char** pazResult = NULL;
|
|
|
char* psqlite_error = NULL;
|
|
|
- CHAR szSQL[1024] = {0};
|
|
|
- sprintf_s(szSQL, _SELECT_BID_INFO__, order.c_str());
|
|
|
- int sqlite_error = sqlite3_get_table(m_psqlite3, szSQL, &pazResult, &nRow, &nCol, &psqlite_error);
|
|
|
+ std::string strSql = _SELECT_SN_;
|
|
|
+ strSql.append(" WHERE StartTime >= '");
|
|
|
+ strSql.append(strBeginTime);
|
|
|
+ strSql.append("' AND StartTime <= '");
|
|
|
+ strSql.append(EndTime);
|
|
|
+ strSql.append("';");
|
|
|
+ int sqlite_error = sqlite3_get_table(m_psqlite3, strSql.c_str(), &pazResult, &nRow, &nCol, &psqlite_error);
|
|
|
if ( sqlite_error != SQLITE_OK)
|
|
|
{
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),szSQL, psqlite_error);
|
|
|
+ GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strSql.c_str(), psqlite_error);
|
|
|
FREE_MSG;
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- if ( nRow == 1 )
|
|
|
+ vtSNData.resize(nRow);
|
|
|
+ std::vector<TB_SN>::iterator it = vtSNData.begin();
|
|
|
+ for(int i = 1; i <= nRow; i++, it++)
|
|
|
{
|
|
|
- binfo.tcount = pazResult[nCol+0];
|
|
|
- binfo.sn_count = pazResult[nCol+1];
|
|
|
- binfo.copy_count = pazResult[nCol+2];
|
|
|
- binfo.report_count = pazResult[nCol+3];
|
|
|
+#ifndef USE_UTF8
|
|
|
+ it->strOrder = pazResult[nCol*i+0];
|
|
|
+ it->strSN = pazResult[nCol*i+1];
|
|
|
+ it->strLine = pazResult[nCol*i+2];
|
|
|
+ it->strStartTime = pazResult[nCol*i+3];
|
|
|
+ it->strFinishedTime = pazResult[nCol*i+4];
|
|
|
+ it->nElapsed = atoi(pazResult[nCol*i+5]);
|
|
|
+ it->nTestResult = atoi(pazResult[nCol*i+6]);
|
|
|
+ it->dDeltaAVGEValue = atof(pazResult[nCol*i+7]);
|
|
|
+ it->strDetails = pazResult[nCol*i+8];
|
|
|
+#else
|
|
|
+
|
|
|
+ it->strOrder = CharEncoding::UTF82ASCII(pazResult[nCol*i+0]);
|
|
|
+ it->strSN = CharEncoding::UTF82ASCII(pazResult[nCol*i+1]);
|
|
|
+ it->strLine = CharEncoding::UTF82ASCII(pazResult[nCol*i+2]);
|
|
|
+ it->strStartTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+3]);
|
|
|
+ it->strFinishedTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+4]);
|
|
|
+ it->nElapsed = atoi(pazResult[nCol*i+5]);
|
|
|
+ it->nTestResult = atoi(pazResult[nCol*i+6]);
|
|
|
+ it->dDeltaAVGEValue = atof(pazResult[nCol*i+7]);
|
|
|
+ it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol*i+8]);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
sqlite3_free_table(pazResult);
|
|
@@ -417,166 +510,27 @@ INT CDataImpl::QueryBidInfo(std::string order, BidInfo& binfo)
|
|
|
return nRow;
|
|
|
}
|
|
|
|
|
|
-INT CDataImpl::InsertMidInfo(STMid &data)
|
|
|
+BOOL CDataImpl::UpdateOrder(TB_ORDER &order)
|
|
|
{
|
|
|
- if(m_psqlite3 == NULL)
|
|
|
- return -1;
|
|
|
-
|
|
|
- std::string strInsert = "INSERT INTO mid(bid, number, pid, ctype, version, purl, psize, pmd5)VALUES ('";
|
|
|
- strInsert.append(data.order);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.number);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.pid);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.ctype);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.version);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.purl);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.psize);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.pmd5);
|
|
|
- strInsert.append("');");
|
|
|
-
|
|
|
- char* psqlite_error = NULL;
|
|
|
- int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
- if(SQLITE_OK != sqlite_error)
|
|
|
- {
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strInsert.c_str(), psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
- }
|
|
|
-
|
|
|
- return sqlite_error;
|
|
|
+ return UpdateOrder(order.strOrder, order.strDeltaEType, order.strDeltaEValue, order.nMode);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-INT CDataImpl::InsertKeyInfo(STKeys &data)
|
|
|
-{
|
|
|
- if(m_psqlite3 == NULL)
|
|
|
- return -1;
|
|
|
-
|
|
|
- std::string strInsert = "INSERT INTO keys(bid, pid, sn, keys) VALUES ('";
|
|
|
- strInsert.append(data.bid);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.pid);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.sn);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.keys);
|
|
|
- strInsert.append("');");
|
|
|
- char* psqlite_error = NULL;
|
|
|
- int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
- if(SQLITE_OK != sqlite_error)
|
|
|
- {
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strInsert.c_str(), psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
- }
|
|
|
-
|
|
|
- return sqlite_error;
|
|
|
-}
|
|
|
-
|
|
|
-INT CDataImpl::InsertLogInfo(STLog &data)
|
|
|
-{
|
|
|
- if(m_psqlite3 == NULL)
|
|
|
- return -1;
|
|
|
-
|
|
|
- std::string strInsert = "INSERT INTO log(type, bid, sn, content, report_date) VALUES ('";
|
|
|
- strInsert.append(data.type);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.bid);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.sn);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.content);
|
|
|
- strInsert.append("','");
|
|
|
- strInsert.append(data.report_date);
|
|
|
- strInsert.append("');");
|
|
|
- char* psqlite_error = NULL;
|
|
|
- int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
- if(SQLITE_OK != sqlite_error)
|
|
|
- {
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strInsert.c_str(), psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
- }
|
|
|
-
|
|
|
- return sqlite_error;
|
|
|
-}
|
|
|
-
|
|
|
-INT CDataImpl::BatchInsertKeyInfo(std::vector<STKeys> &vtdata)
|
|
|
-{
|
|
|
- if(m_psqlite3 == NULL)
|
|
|
- return -1;
|
|
|
-
|
|
|
- char* psqlite_error = NULL;
|
|
|
- INT nRet = sqlite3_exec(m_psqlite3, "begin;", 0, 0, &psqlite_error);
|
|
|
- if ( nRet != SQLITE_OK )
|
|
|
- {
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:begin,%s"), psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
- return nRet;
|
|
|
- }
|
|
|
-
|
|
|
- sqlite3_stmt *stmt;
|
|
|
- const char* sql = "INSERT INTO keys(bid, pid, sn, keys) VALUES (?,?,?,?)";
|
|
|
- sqlite3_prepare_v2(m_psqlite3, sql, strlen(sql), &stmt, 0);
|
|
|
-
|
|
|
- std::vector<STKeys>::iterator it = vtdata.begin();
|
|
|
- for ( int i = 0; it != vtdata.end(); it++, i++ )
|
|
|
- {
|
|
|
- sqlite3_reset(stmt);
|
|
|
- sqlite3_bind_text(stmt, 1, it->bid.c_str(), it->bid.size(), SQLITE_STATIC);
|
|
|
- sqlite3_bind_text(stmt, 2, it->pid.c_str(), it->pid.size(), SQLITE_STATIC);
|
|
|
- sqlite3_bind_text(stmt, 3, it->sn.c_str(), it->sn.size(), SQLITE_STATIC);
|
|
|
- sqlite3_bind_text(stmt, 4, it->keys.c_str(), it->keys.size(), SQLITE_STATIC);
|
|
|
- sqlite3_step(stmt);
|
|
|
- }
|
|
|
-
|
|
|
- nRet = sqlite3_finalize(stmt);
|
|
|
- if ( nRet != SQLITE_OK )
|
|
|
- {
|
|
|
-
|
|
|
- nRet = sqlite3_exec(m_psqlite3, "rollback;", 0, 0, &psqlite_error);
|
|
|
- if ( nRet != SQLITE_OK )
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:rollback,%s"),psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
- return nRet;
|
|
|
- }
|
|
|
-
|
|
|
- nRet = sqlite3_exec(m_psqlite3, "commit;", 0, 0, &psqlite_error);
|
|
|
- if ( nRet != SQLITE_OK )
|
|
|
- {
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:commit,%s"),psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
- return nRet;
|
|
|
- }
|
|
|
-
|
|
|
- return SQLITE_OK;
|
|
|
-}
|
|
|
-
|
|
|
-BOOL CDataImpl::UpdateMidInfo(STMid &data)
|
|
|
+BOOL CDataImpl::UpdateOrder(std::string strOrder, std::string strDeltaEType, std::string strDeltaEValue, int nMode)
|
|
|
{
|
|
|
if(m_psqlite3 == NULL)
|
|
|
return FALSE;
|
|
|
|
|
|
- std::string strInsert = "UPDATE mid SET pid ='";
|
|
|
- strInsert.append(data.pid);
|
|
|
- strInsert.append("', ctype='");
|
|
|
- strInsert.append(data.ctype);
|
|
|
- strInsert.append("', version='");
|
|
|
- strInsert.append(data.version);
|
|
|
- strInsert.append("', purl='");
|
|
|
- strInsert.append(data.purl);
|
|
|
- strInsert.append("', psize='");
|
|
|
- strInsert.append(data.psize);
|
|
|
- strInsert.append("', pmd5='");
|
|
|
- strInsert.append(data.pmd5);
|
|
|
- strInsert.append("', number='");
|
|
|
- strInsert.append(data.number);
|
|
|
+ char szValue[8]={0};
|
|
|
+ std::string strInsert = "UPDATE DebugOrders SET DEType ='";
|
|
|
+ strInsert.append(strDeltaEType);
|
|
|
+ strInsert.append("', DEValue='");
|
|
|
+ strInsert.append(strDeltaEValue);
|
|
|
+ strInsert.append("', Mode='");
|
|
|
+ _itoa_s(nMode, szValue, 10);
|
|
|
+ strInsert.append(szValue);
|
|
|
strInsert.append("'");
|
|
|
- strInsert.append(" WHERE bid ='");
|
|
|
- strInsert.append(data.order);
|
|
|
+ strInsert.append(" WHERE OrderID ='");
|
|
|
+ strInsert.append(strOrder);
|
|
|
strInsert.append("';");
|
|
|
|
|
|
char* psqlite_error = NULL;
|
|
@@ -591,51 +545,39 @@ BOOL CDataImpl::UpdateMidInfo(STMid &data)
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
-BOOL CDataImpl::UpdateDownloadStatus(std::string order, int status, std::string des )
|
|
|
+BOOL CDataImpl::UpdateSNData(TB_SN &sn_data)
|
|
|
{
|
|
|
- if(m_psqlite3 == NULL)
|
|
|
- return FALSE;
|
|
|
-
|
|
|
- char szStatus[10] = {0};
|
|
|
- _itoa_s(status, szStatus, 10);
|
|
|
- std::string strInsert = "UPDATE mid SET status ='";
|
|
|
- strInsert.append(szStatus);
|
|
|
- strInsert.append("', des='");
|
|
|
- if ( status == -1 )
|
|
|
- {
|
|
|
- strInsert.append(des);
|
|
|
- strInsert.append("'");
|
|
|
- }
|
|
|
- else if ( status == 1 )
|
|
|
- {
|
|
|
- strInsert.append("下载成功");
|
|
|
- strInsert.append("',finish_date=current_timestamp");
|
|
|
- }
|
|
|
- strInsert.append(" WHERE bid ='");
|
|
|
- strInsert.append(order);
|
|
|
- strInsert.append("';");
|
|
|
-
|
|
|
- char* psqlite_error = NULL;
|
|
|
- int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
- if(SQLITE_OK != sqlite_error)
|
|
|
- {
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strInsert.c_str(), psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
- return FALSE;
|
|
|
- }
|
|
|
-
|
|
|
- return TRUE;
|
|
|
+ return UpdateSNData(sn_data.strOrder, sn_data.strSN, sn_data.strLine, sn_data.strStartTime, sn_data.strFinishedTime, sn_data.nElapsed, sn_data.nTestResult, sn_data.dDeltaAVGEValue, sn_data.strDetails);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-BOOL CDataImpl::UpdateKeyCopyStatus(std::string sn)
|
|
|
+BOOL CDataImpl::UpdateSNData(std::string strOrder,std::string strSN, std::string strLine, std::string strTestTime, std::string strFinishedTime, int nElapsed, int nTestResult, double dAVGDeltaEVlaue, std::string strDetails)
|
|
|
{
|
|
|
if(m_psqlite3 == NULL)
|
|
|
return FALSE;
|
|
|
|
|
|
- std::string strInsert = "UPDATE keys SET copy_date=current_timestamp";
|
|
|
- strInsert.append(" WHERE sn ='");
|
|
|
- strInsert.append(sn);
|
|
|
+ char szValue[8]={0};
|
|
|
+ std::string strInsert = "UPDATE DebugSN SET OrderID ='";
|
|
|
+ strInsert.append(strOrder);
|
|
|
+ strInsert.append("', Line='");
|
|
|
+ strInsert.append(strLine);
|
|
|
+ strInsert.append("', StartTime='");
|
|
|
+ strInsert.append(strTestTime);
|
|
|
+ strInsert.append("', FinishTime='");
|
|
|
+ strInsert.append(strFinishedTime);
|
|
|
+ _itoa_s(nElapsed, szValue, 10);
|
|
|
+ strInsert.append("', ElapsedTime='");
|
|
|
+ strInsert.append(szValue);
|
|
|
+ _itoa_s(nTestResult, szValue, 10);
|
|
|
+ strInsert.append("', TestResult='");
|
|
|
+ strInsert.append(szValue);
|
|
|
+ _gcvt_s(szValue, dAVGDeltaEVlaue, 3);
|
|
|
+ strInsert.append("', DEAvgValue='");
|
|
|
+ strInsert.append(szValue);
|
|
|
+ strInsert.append("', Outcome='");
|
|
|
+ strInsert.append(strDetails);
|
|
|
+ strInsert.append("'");
|
|
|
+ strInsert.append(" WHERE SN ='");
|
|
|
+ strInsert.append(strOrder);
|
|
|
strInsert.append("';");
|
|
|
|
|
|
char* psqlite_error = NULL;
|
|
@@ -650,102 +592,40 @@ BOOL CDataImpl::UpdateKeyCopyStatus(std::string sn)
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
-BOOL CDataImpl::UpdateKeyReportStatus(std::string sn)
|
|
|
-{
|
|
|
- if(m_psqlite3 == NULL)
|
|
|
- return FALSE;
|
|
|
|
|
|
- std::string strInsert = "UPDATE keys SET report_date=current_timestamp";
|
|
|
- strInsert.append(" WHERE sn ='");
|
|
|
- strInsert.append(sn);
|
|
|
- strInsert.append("' and copy_date <> '';");
|
|
|
|
|
|
- char* psqlite_error = NULL;
|
|
|
- int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
- if(SQLITE_OK != sqlite_error)
|
|
|
- {
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strInsert.c_str(), psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
- return FALSE;
|
|
|
- }
|
|
|
-#ifdef _DEBUG
|
|
|
-
|
|
|
- sqlite3_exec(m_psqlite3, "UPDATE keys set copy_date = CURRENT_TIMESTAMP;", NULL, NULL, &psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
-#endif
|
|
|
- return TRUE;
|
|
|
-}
|
|
|
|
|
|
-BOOL CDataImpl::BatchUpdateKeyReportStatus(std::vector<STKeys> &vtKeys)
|
|
|
+
|
|
|
+
|
|
|
+BOOL CDataImpl::DeleteOrder(std::string strOrder)
|
|
|
{
|
|
|
if(m_psqlite3 == NULL)
|
|
|
return FALSE;
|
|
|
|
|
|
- char* psqlite_error = NULL;
|
|
|
- INT nRet = sqlite3_exec(m_psqlite3, "begin;", 0, 0, &psqlite_error);
|
|
|
- if ( nRet != SQLITE_OK )
|
|
|
- {
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:begin,%s"), psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
+ if ( TransactionBegin() != 0 )
|
|
|
return FALSE;
|
|
|
- }
|
|
|
|
|
|
- char szSql[1024] = {0};
|
|
|
- const char* szFormat = "UPDATE keys set report_date=current_timestamp WHERE sn = '%s'";
|
|
|
- std::vector<STKeys>::iterator it = vtKeys.begin();
|
|
|
- for ( int i = 0; it != vtKeys.end(); it++, i++ )
|
|
|
+ CHAR szSQL[1024] = {0};
|
|
|
+ sprintf_s(szSQL, "delete from DebugOrders where OrderID = '%s'; delete from DebugSN where OrderID = '%s';", strOrder.c_str(), strOrder.c_str());
|
|
|
+ char* psqlite_error = NULL;
|
|
|
+ int sqlite_error = sqlite3_exec(m_psqlite3, szSQL, NULL, 0, &psqlite_error);
|
|
|
+ if(SQLITE_OK != sqlite_error)
|
|
|
{
|
|
|
- sprintf_s(szSql,szFormat,it->sn.c_str());
|
|
|
- sqlite3_exec(m_psqlite3, szSql, NULL, NULL, &psqlite_error);
|
|
|
+ GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),szSQL, psqlite_error);
|
|
|
FREE_MSG;
|
|
|
- }
|
|
|
-
|
|
|
- if ( nRet != SQLITE_OK )
|
|
|
- {
|
|
|
|
|
|
- nRet = sqlite3_exec(m_psqlite3, "rollback;", 0, 0, &psqlite_error);
|
|
|
- if ( nRet != SQLITE_OK )
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:rollback,%s"),psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
- return FALSE;
|
|
|
- }
|
|
|
-
|
|
|
- nRet = sqlite3_exec(m_psqlite3, "commit;", 0, 0, &psqlite_error);
|
|
|
- if ( nRet != SQLITE_OK )
|
|
|
- {
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:commit,%s"),psqlite_error);
|
|
|
+ sqlite3_exec(m_psqlite3, "rollback;", 0, 0, &psqlite_error);
|
|
|
FREE_MSG;
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
- return TRUE;
|
|
|
-}
|
|
|
-
|
|
|
-BOOL CDataImpl::UpdateLogReportStatus(std::string sn, std::string type)
|
|
|
-{
|
|
|
- if(m_psqlite3 == NULL)
|
|
|
- return FALSE;
|
|
|
-
|
|
|
- std::string strInsert = "UPDATE log SET report_date=current_timestamp";
|
|
|
- strInsert.append(" WHERE sn ='");
|
|
|
- strInsert.append(sn);
|
|
|
- strInsert.append("' and type ='");
|
|
|
- strInsert.append(type);
|
|
|
- strInsert.append("';");
|
|
|
-
|
|
|
- char* psqlite_error = NULL;
|
|
|
- int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
- if(SQLITE_OK != sqlite_error)
|
|
|
- {
|
|
|
- GLOBAL::WriteTextLog(_T("sqlite3 error:%s,%s"),strInsert.c_str(), psqlite_error);
|
|
|
- FREE_MSG;
|
|
|
+ if ( TransactionCommit() != 0 )
|
|
|
return FALSE;
|
|
|
- }
|
|
|
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
-BOOL CDataImpl::RemoveBidData(std::string order)
|
|
|
+BOOL CDataImpl::DeleteSNData(std::string strSN)
|
|
|
{
|
|
|
if(m_psqlite3 == NULL)
|
|
|
return FALSE;
|
|
@@ -754,7 +634,7 @@ BOOL CDataImpl::RemoveBidData(std::string order)
|
|
|
return FALSE;
|
|
|
|
|
|
CHAR szSQL[1024] = {0};
|
|
|
- sprintf_s(szSQL, "delete from mid where bid = '%s'; delete from keys where bid = '%s'; delete from log where bid = '%s'", order.c_str(), order.c_str(), order.c_str());
|
|
|
+ sprintf_s(szSQL, "delete from DebugSN where SN = '%s';", strSN.c_str());
|
|
|
char* psqlite_error = NULL;
|
|
|
int sqlite_error = sqlite3_exec(m_psqlite3, szSQL, NULL, 0, &psqlite_error);
|
|
|
if(SQLITE_OK != sqlite_error)
|