From 0d2da4a2507a5a8d34bf7f736727917d791df0d2 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期三, 14 五月 2025 14:48:31 +0800
Subject: [PATCH] 1. 添加数据库事务提交,减少频繁执行 SQL 写操作
---
SourceCode/Bond/Servo/ToolUnits.cpp | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/ToolUnits.cpp b/SourceCode/Bond/Servo/ToolUnits.cpp
index a3e1725..f3a88bc 100644
--- a/SourceCode/Bond/Servo/ToolUnits.cpp
+++ b/SourceCode/Bond/Servo/ToolUnits.cpp
@@ -2,6 +2,7 @@
#include "ToolUnits.h"
#include <chrono>
#include <memory>
+#include <sstream>
CToolUnits::CToolUnits()
@@ -306,4 +307,26 @@
bool CToolUnits::startsWith(const std::string& str, const std::string& prefix)
{
return str.size() >= prefix.size() && str.compare(0, prefix.size(), prefix) == 0;
+}
+
+std::string& CToolUnits::toHexString(int value, std::string& strOut)
+{
+ std::stringstream ss;
+ ss << std::hex << value;
+ strOut = ss.str();
+
+ return strOut;
+}
+
+void CToolUnits::convertString(const char* pszBuffer, int size, std::string& strOut)
+{
+ strOut.clear();
+ int nLength = 0;
+ for (int i = 0; i < size; i++) {
+ if (pszBuffer[i] == '\0') break;
+ nLength++;
+ }
+ if (nLength > 0) {
+ strOut = std::string(pszBuffer, nLength);
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3