From d1b72117058f1131046b6aa3add8e3ccfae033d8 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 09 十一月 2026 10:36:07 +0800
Subject: [PATCH] docs: CAN 模拟器独立 TCP 服务进程设计规格(统一 CanDeviceDriver + 双工推送协议)
---
HMI.Core/Util/Sqlite3Helper.cs | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/HMI.Core/Util/Sqlite3Helper.cs b/HMI.Core/Util/Sqlite3Helper.cs
index bc979d4..e271025 100644
--- a/HMI.Core/Util/Sqlite3Helper.cs
+++ b/HMI.Core/Util/Sqlite3Helper.cs
@@ -11,6 +11,8 @@
private string ConnectString = string.Empty;
+ public const int MAX_ATTACHED = 30;
+
private SQLiteConnection conn = null;
public Sqlite3Helper(string DBFile)
@@ -52,6 +54,46 @@
}
}
+ public long InsertWithId(string Sql)
+ {
+ try
+ {
+ if (Sql.EndsWith(";"))
+ {
+ Sql += "SELECT last_insert_rowid();";
+ }
+ else
+ {
+ Sql += ";SELECT last_insert_rowid();";
+ }
+ using (var cmd = new SQLiteCommand(Sql, conn))
+ {
+ return (long)cmd.ExecuteScalar();
+ }
+ }
+ catch (Exception ex)
+ {
+ string message = "ExecuteSql Error:" + ex.Message;
+ throw new Exception(message);
+ }
+ }
+
+ public object SelectOne(string Sql)
+ {
+ try
+ {
+ using (var cmd = new SQLiteCommand(Sql, conn))
+ {
+ return cmd.ExecuteScalar();
+ }
+ }
+ catch (Exception ex)
+ {
+ string message = "ExecuteSql Error:" + ex.Message;
+ throw new Exception(message);
+ }
+ }
+
public int ExecuteBatch(IEnumerable<string> sqls)
{
SQLiteTransaction tr = null;
--
Gitblit v1.9.1