|
@@ -277,6 +277,7 @@ INT CDataImpl::QueryOrder(std::string strOrder, TB_ORDER &order)
|
|
|
order.strOrder = pazResult[nCol+0];
|
|
|
order.strDeltaEType = pazResult[nCol+1];
|
|
|
order.strDeltaEValue = pazResult[nCol+2];
|
|
|
+ order.strMode = pazResult[nCol+3];
|
|
|
order.nMode = atoi(pazResult[nCol+3]);
|
|
|
order.strCreateTime = pazResult[nCol+4];
|
|
|
#else
|
|
@@ -284,6 +285,7 @@ INT CDataImpl::QueryOrder(std::string strOrder, TB_ORDER &order)
|
|
|
order.strOrder = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
|
|
|
order.strDeltaEType = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
|
|
|
order.strDeltaEValue = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
|
|
|
+ order.strMode = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
|
|
|
order.nMode = atoi(pazResult[nCol+3]);
|
|
|
order.strCreateTime = CharEncoding::UTF82ASCII(pazResult[nCol+4]);
|
|
|
#endif
|
|
@@ -326,14 +328,16 @@ INT CDataImpl::QueryOrders(std::vector<TB_ORDER> &vtOrders, std::string strBegin
|
|
|
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->strMode = pazResult[i*nCol+3];
|
|
|
+ it->nMode = atoi(it->strMode.c_str());
|
|
|
it->strCreateTime = pazResult[i*nCol+4];
|
|
|
#else
|
|
|
// 由Native for SQLite3插入的数据,都是utf8格式;
|
|
|
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->strMode = CharEncoding::UTF82ASCII(pazResult[i*nCol+3]);
|
|
|
+ it->nMode = atoi(it->strMode.c_str());
|
|
|
it->strCreateTime = CharEncoding::UTF82ASCII(pazResult[i*nCol+4]);
|
|
|
#endif
|
|
|
}
|
|
@@ -372,8 +376,11 @@ INT CDataImpl::QuerySNData(std::string strSN, TB_SN &sn_data)
|
|
|
sn_data.strSN = pazResult[nCol+1];
|
|
|
sn_data.strLine = pazResult[nCol+2];
|
|
|
sn_data.strTestTime = pazResult[nCol+3];
|
|
|
- sn_data.nElapsed = atoi(pazResult[nCol+4]);
|
|
|
+ sn_data.strElapsed = pazResult[nCol+4];
|
|
|
+ sn_data.nElapsed = atoi(sn_data.strElapsed.c_str());
|
|
|
+ sn_data.strTestResult = pazResult[nCol+5];
|
|
|
sn_data.nTestResult = atoi(pazResult[nCol+5]);
|
|
|
+ sn_data.strDeltaAVGEValue = pazResult[nCol+6];
|
|
|
sn_data.dDeltaAVGEValue = atof(pazResult[nCol+6]);
|
|
|
sn_data.strDetails = pazResult[nCol+7];
|
|
|
#else
|
|
@@ -382,8 +389,11 @@ INT CDataImpl::QuerySNData(std::string strSN, TB_SN &sn_data)
|
|
|
sn_data.strSN = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
|
|
|
sn_data.strLine = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
|
|
|
sn_data.strTestTime = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
|
|
|
+ sn_data.strElapsed = CharEncoding::UTF82ASCII(pazResult[nCol+4]);
|
|
|
sn_data.nElapsed = atoi(pazResult[nCol+4]);
|
|
|
+ sn_data.strTestResult = CharEncoding::UTF82ASCII(pazResult[nCol+5]);
|
|
|
sn_data.nTestResult = atoi(pazResult[nCol+5]);
|
|
|
+ sn_data.strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[nCol+6]);
|
|
|
sn_data.dDeltaAVGEValue = atof(pazResult[nCol+6]);
|
|
|
sn_data.strDetails = CharEncoding::UTF82ASCII(pazResult[nCol+7]);
|
|
|
#endif
|
|
@@ -421,24 +431,30 @@ INT CDataImpl::QuerySNData(std::string strOrder, std::vector<TB_SN> &vtSNdata)
|
|
|
for(int i = 1; i <= nRow; i++, it++)
|
|
|
{
|
|
|
#ifndef USE_UTF8
|
|
|
- it->strOrder = pazResult[nCol*i+0];
|
|
|
- it->strSN = pazResult[nCol*i+1];
|
|
|
- it->strLine = pazResult[nCol*i+2];
|
|
|
- it->strTestTime = pazResult[nCol*i+3];
|
|
|
- it->nElapsed = atoi(pazResult[nCol*i+4]);
|
|
|
- it->nTestResult = atoi(pazResult[nCol*i+5]);
|
|
|
- it->dDeltaAVGEValue = atof(pazResult[nCol*i+6]);
|
|
|
- it->strDetails = pazResult[nCol*i+7];
|
|
|
+ it->strOrder = pazResult[nCol+0];
|
|
|
+ it->strSN = pazResult[nCol+1];
|
|
|
+ it->strLine = pazResult[nCol+2];
|
|
|
+ it->strTestTime = pazResult[nCol+3];
|
|
|
+ it->strElapsed = pazResult[nCol+4];
|
|
|
+ it->nElapsed = atoi(it->strElapsed.c_str());
|
|
|
+ it->strTestResult = pazResult[nCol+5];
|
|
|
+ it->nTestResult = atoi(pazResult[nCol+5]);
|
|
|
+ it->strDeltaAVGEValue = pazResult[nCol+6];
|
|
|
+ it->dDeltaAVGEValue = atof(pazResult[nCol+6]);
|
|
|
+ it->strDetails = pazResult[nCol+7];
|
|
|
#else
|
|
|
// 由Native for SQLite3插入的数据,都是utf8格式;
|
|
|
- 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->strTestTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+3]);
|
|
|
- it->nElapsed = atoi(pazResult[nCol*i+4]);
|
|
|
- it->nTestResult = atoi(pazResult[nCol*i+5]);
|
|
|
- it->dDeltaAVGEValue = atof(pazResult[nCol*i+6]);
|
|
|
- it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol*i+7]);
|
|
|
+ it->strOrder = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
|
|
|
+ it->strSN = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
|
|
|
+ it->strLine = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
|
|
|
+ it->strTestTime = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
|
|
|
+ it->strElapsed = CharEncoding::UTF82ASCII(pazResult[nCol+4]);
|
|
|
+ it->nElapsed = atoi(pazResult[nCol+4]);
|
|
|
+ it->strTestResult = CharEncoding::UTF82ASCII(pazResult[nCol+5]);
|
|
|
+ it->nTestResult = atoi(pazResult[nCol+5]);
|
|
|
+ it->strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[nCol+6]);
|
|
|
+ it->dDeltaAVGEValue = atof(pazResult[nCol+6]);
|
|
|
+ it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol+7]);
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -476,24 +492,92 @@ INT CDataImpl::QuerySNData(std::vector<TB_SN> &vtSNData, std::string strBeginTim
|
|
|
for(int i = 1; i <= nRow; i++, it++)
|
|
|
{
|
|
|
#ifndef USE_UTF8
|
|
|
- it->strOrder = pazResult[nCol*i+0];
|
|
|
- it->strSN = pazResult[nCol*i+1];
|
|
|
- it->strLine = pazResult[nCol*i+2];
|
|
|
- it->strTestTime = pazResult[nCol*i+3];
|
|
|
- it->nElapsed = atoi(pazResult[nCol*i+4]);
|
|
|
- it->nTestResult = atoi(pazResult[nCol*i+5]);
|
|
|
- it->dDeltaAVGEValue = atof(pazResult[nCol*i+6]);
|
|
|
- it->strDetails = pazResult[nCol*i+7];
|
|
|
+ it->strOrder = pazResult[nCol+0];
|
|
|
+ it->strSN = pazResult[nCol+1];
|
|
|
+ it->strLine = pazResult[nCol+2];
|
|
|
+ it->strTestTime = pazResult[nCol+3];
|
|
|
+ it->strElapsed = pazResult[nCol+4];
|
|
|
+ it->nElapsed = atoi(it->strElapsed.c_str());
|
|
|
+ it->strTestResult = pazResult[nCol+5];
|
|
|
+ it->nTestResult = atoi(pazResult[nCol+5]);
|
|
|
+ it->strDeltaAVGEValue = pazResult[nCol+6];
|
|
|
+ it->dDeltaAVGEValue = atof(pazResult[nCol+6]);
|
|
|
+ it->strDetails = pazResult[nCol+7];
|
|
|
+#else
|
|
|
+ // 由Native for SQLite3插入的数据,都是utf8格式;
|
|
|
+ it->strOrder = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
|
|
|
+ it->strSN = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
|
|
|
+ it->strLine = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
|
|
|
+ it->strTestTime = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
|
|
|
+ it->strElapsed = CharEncoding::UTF82ASCII(pazResult[nCol+4]);
|
|
|
+ it->nElapsed = atoi(pazResult[nCol+4]);
|
|
|
+ it->strTestResult = CharEncoding::UTF82ASCII(pazResult[nCol+5]);
|
|
|
+ it->nTestResult = atoi(pazResult[nCol+5]);
|
|
|
+ it->strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[nCol+6]);
|
|
|
+ it->dDeltaAVGEValue = atof(pazResult[nCol+6]);
|
|
|
+ it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol+7]);
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
+ sqlite3_free_table(pazResult);
|
|
|
+
|
|
|
+ return nRow;
|
|
|
+}
|
|
|
+
|
|
|
+INT CDataImpl::QuerySNData(std::vector<TB_SN> &vtSNData, std::string strWhere)
|
|
|
+{
|
|
|
+ if ( m_psqlite3 == NULL )
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ INT nRow = 0;
|
|
|
+ INT nCol = 0;
|
|
|
+
|
|
|
+ char** pazResult = NULL;
|
|
|
+ char* psqlite_error = NULL;
|
|
|
+ std::string strSql = _SELECT_SN_;
|
|
|
+ if ( strWhere.size() )
|
|
|
+ {
|
|
|
+ strSql.append(" WHERE ");
|
|
|
+ strSql.append(strWhere);
|
|
|
+ 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"),strSql.c_str(), psqlite_error);
|
|
|
+ FREE_MSG;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ vtSNData.resize(nRow);
|
|
|
+ std::vector<TB_SN>::iterator it = vtSNData.begin();
|
|
|
+ for(int i = 1; i <= nRow; i++, it++)
|
|
|
+ {
|
|
|
+#ifndef USE_UTF8
|
|
|
+ it->strOrder = pazResult[nCol+0];
|
|
|
+ it->strSN = pazResult[nCol+1];
|
|
|
+ it->strLine = pazResult[nCol+2];
|
|
|
+ it->strTestTime = pazResult[nCol+3];
|
|
|
+ it->strElapsed = pazResult[nCol+4];
|
|
|
+ it->nElapsed = atoi(it->strElapsed.c_str());
|
|
|
+ it->strTestResult = pazResult[nCol+5];
|
|
|
+ it->nTestResult = atoi(pazResult[nCol+5]);
|
|
|
+ it->strDeltaAVGEValue = pazResult[nCol+6];
|
|
|
+ it->dDeltaAVGEValue = atof(pazResult[nCol+6]);
|
|
|
+ it->strDetails = pazResult[nCol+7];
|
|
|
#else
|
|
|
// 由Native for SQLite3插入的数据,都是utf8格式;
|
|
|
- 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->strTestTime = CharEncoding::UTF82ASCII(pazResult[nCol*i+3]);
|
|
|
- it->nElapsed = atoi(pazResult[nCol*i+4]);
|
|
|
- it->nTestResult = atoi(pazResult[nCol*i+5]);
|
|
|
- it->dDeltaAVGEValue = atof(pazResult[nCol*i+6]);
|
|
|
- it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol*i+7]);
|
|
|
+ it->strOrder = CharEncoding::UTF82ASCII(pazResult[nCol+0]);
|
|
|
+ it->strSN = CharEncoding::UTF82ASCII(pazResult[nCol+1]);
|
|
|
+ it->strLine = CharEncoding::UTF82ASCII(pazResult[nCol+2]);
|
|
|
+ it->strTestTime = CharEncoding::UTF82ASCII(pazResult[nCol+3]);
|
|
|
+ it->strElapsed = CharEncoding::UTF82ASCII(pazResult[nCol+4]);
|
|
|
+ it->nElapsed = atoi(pazResult[nCol+4]);
|
|
|
+ it->strTestResult = CharEncoding::UTF82ASCII(pazResult[nCol+5]);
|
|
|
+ it->nTestResult = atoi(pazResult[nCol+5]);
|
|
|
+ it->strDeltaAVGEValue = CharEncoding::UTF82ASCII(pazResult[nCol+6]);
|
|
|
+ it->dDeltaAVGEValue = atof(pazResult[nCol+6]);
|
|
|
+ it->strDetails = CharEncoding::UTF82ASCII(pazResult[nCol+7]);
|
|
|
#endif
|
|
|
}
|
|
|
|