feat(db2): C++20 数据库 RPC 服务,对齐 Python db 模块 execute 路由

- 完整实现 execute 路由(select/insert/update/delete)
- 相同 where 语法(eq/ne/gt/lt/ge/le/like/in)及响应格式
- 启动时从 confs 拉取 db.ini,支持环境变量和命令行覆盖
- per-thread SQLite 连接 + WAL/mmap/busy_timeout PRAGMA
- PRAGMA table_info 驱动的列类型反射与缓存
- $now 哨兵值自动替换为 UTC 时间
- 内置 Logs 表自动建表 + 后台清理线程(retention_days + max_records)
- 表名白名单校验防 SQL 注入
- gateway DbC::call_msg() 零改动可直接切换
This commit is contained in:
qing committed 2026-08-06 17:40:07 +00:00
1 parent 49ed3f738f
commit 1970f3f824
6 files changed
+928

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
CPP = g++
CPPFLAGS = -std=c++20 -O3 -Wall -Werror -pipe
INCS = -I ../libmsg/inc
LIBS = -L ../libmsg/build -lus_msg -lboost_json -lsqlite3
RPATH = -Wl,-rpath,'$$ORIGIN/../../libmsg/build'
BUILD = build
TARGET = $(BUILD)/db2
SRC = src/db2.cpp
all: $(TARGET)
$(BUILD):
mkdir -p $(BUILD)
$(TARGET): $(SRC) | $(BUILD)
$(CPP) $(CPPFLAGS) $(INCS) -o $@ $< $(LIBS) $(RPATH)
clean:
rm -f $(TARGET)
.PHONY: all clean