基线:UDP 收包长度校验 + SQLite 表描述符重构 + 清理设计文档
This commit is contained in:
@@ -66,12 +66,22 @@ private:
|
||||
bool createTableInternal(const std::string& tableName, const std::string& columns);
|
||||
bool createAllTablesUnlocked();
|
||||
|
||||
// 泛化插入:表名 + 列描述(名称 + 绑定器),所有类型共用这一条路径
|
||||
// 列描述:名称 + SQL 类型 + 绑定器(无捕获函数指针)
|
||||
struct Column {
|
||||
const char* name;
|
||||
const char* sqlType;
|
||||
void (*bind)(sqlite3_stmt*, int& idx, const void* obj);
|
||||
};
|
||||
bool insertGeneric(const std::string& table, const std::vector<Column>& cols, const void* obj);
|
||||
// 表描述:表名 + 数据列。建表(DDL)与插入(DML)共用这一份,作为唯一数据源。
|
||||
struct TableDesc {
|
||||
const char* name;
|
||||
std::vector<Column> columns;
|
||||
};
|
||||
|
||||
// 泛化插入:按表名在注册表中查找描述并绑定,所有类型共用这一条路径
|
||||
bool insertGeneric(const char* tableName, const void* obj);
|
||||
// 所有协议结构表的描述注册表(不含 msg_log 等特殊表)
|
||||
static const std::vector<TableDesc>& allTables();
|
||||
};
|
||||
|
||||
#endif // SQLITE_H
|
||||
|
||||
Reference in New Issue
Block a user