|
@@ -661,6 +661,50 @@ BOOL CDataImpl::UpdateKeyReportStatus(std::string sn)
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
+BOOL CDataImpl::BatchUpdateKeyReportStatus(std::vector<STKeys> &vtKeys)
|
|
|
+{
|
|
|
+ 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 )
|
|
|
+ {
|
|
|
+ FREE_MSG;
|
|
|
+ return FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
+ sqlite3_stmt *stmt;
|
|
|
+ const char* sql = "UPDATE keys set report_date=current_timestamp WHERE sn = '?'";
|
|
|
+ sqlite3_prepare_v2(m_psqlite3, sql, strlen(sql), &stmt, 0);
|
|
|
+
|
|
|
+ std::vector<STKeys>::iterator it = vtKeys.begin();
|
|
|
+ for ( int i = 0; it != vtKeys.end(); it++, i++ )
|
|
|
+ {
|
|
|
+ sqlite3_reset(stmt);
|
|
|
+ sqlite3_bind_text(stmt, 1, it->sn.c_str(), it->sn.size(), SQLITE_STATIC);
|
|
|
+ sqlite3_step(stmt);
|
|
|
+ }
|
|
|
+
|
|
|
+ nRet = sqlite3_finalize(stmt);
|
|
|
+ if ( nRet != SQLITE_OK )
|
|
|
+ {
|
|
|
+ // »Ø¹öÊÂÎñ;
|
|
|
+ nRet = sqlite3_exec(m_psqlite3, "rollback;", 0, 0, &psqlite_error);
|
|
|
+ FREE_MSG;
|
|
|
+ return FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
+ nRet = sqlite3_exec(m_psqlite3, "commit;", 0, 0, &psqlite_error);
|
|
|
+ if ( nRet != SQLITE_OK )
|
|
|
+ {
|
|
|
+ FREE_MSG;
|
|
|
+ return FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
+ return TRUE;
|
|
|
+}
|
|
|
+
|
|
|
BOOL CDataImpl::UpdateLogReportStatus(std::string sn, std::string type)
|
|
|
{
|
|
|
if(m_psqlite3 == NULL)
|