/* * @Description: file content * @Author: why * @version: * @Date: 2025-02-28 08:22:32 * @LastEditors: why * @LastEditTime: 2025-02-28 17:56:31 */ #include #include #include #include #include #include #include "common/inc/json.hpp" #include "F_GetSaveCount.h" #include "bizservice.h" #include "ToolUtils.h" using namespace std; using json = nlohmann::json ;// for convenience typedef unsigned char BYTE; typedef struct topic{ std::string src; std::string des; std::string sid; std::string fid; } topic_type; REGISTER_BIZSERVICE("F-GetSaveCount",GetSaveCount); int GetSaveCount::SQLBatch_exc(sqlite3 *db,std::vector &sql_list,std::vector &result){ char *errMsg = nullptr; const char *sql; int rc; int resp = 0; // 开启事务 if (sqlite3_exec(db, "BEGIN TRANSACTION;", nullptr, nullptr, &errMsg) != SQLITE_OK) { std::cerr << "事务开启失败: " << errMsg << std::endl; sqlite3_free(errMsg); return -1; } // 执行批量插入操作 sqlite3_stmt *stmt; int idx = 0; int count = 0; for(const auto &k:sql_list){ std::cout << "cmd:"< sql_list; std::vector result; sql_list.clear(); result.clear(); std::string table_name ; try{ value = json::parse(msg.payload); } catch(const std::exception &e){ std::cout << "topic "<().c_str()); ToolUtils::decode_blob(&afn,4,subvalue["afn"].get().c_str()); std::stringstream ss; //table_name =search_table_db(afn,dataid); table_name = "frozen"; int choice = std::stoi(subvalue["choice"].get()); time_t from = 0,to = time(NULL); std::string colum(""); switch(choice){ case 0: break; case 1: colum = "createdtime"; from = std::stoi(subvalue["from"].get()); to = std::stoi(subvalue["to"].get()); break; case 2: colum = "frozentime"; from = std::stoi(subvalue["from"].get()); to = std::stoi(subvalue["to"].get()); break; default: return -1;//illegal } ss << "seletc count (*) from " <())<<" and"\ <= "<< from<<" and " <