eis/mix_cc/sql
2026-05-09 11:23:45 +08:00
..
database Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
op Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
CMakeLists.txt Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
column.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
condition.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
delete_from.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
details.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
exec.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
from.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
insert_into.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
make_table.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
preprocessor.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
public.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
readme.md Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
select.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
set.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
sqlapi_warpper.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
statement.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
update.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
value.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00
where.h Initial commit: EIS C++ project with multi-process code 2026-05-09 11:23:45 +08:00

mix_cc::sql

一个简易的高效的c++ sql接口和查询库

项目依赖

  1. 编译器最低支持 c++17/20 (17会导致一处的异常处理无法使用)
  2. sqlapi++
  3. boost 1.75(min)

目前支持的字段包括

  1. select
  2. from
  3. where
  4. insert_into
  5. update
  6. set
  7. delete_from

使用流程

  1. 使用make_table中的宏MIX_CC_SQL_MAKE_TABLE(表名,(列属性1,列名1),(列属性2,列名2),...(列属性n,列名n),) n <= 40 构建目标表
  2. 使用sql字段构建sql语句
auto sql_statement =
        select(t_rule_cfg.algId(), t_rule_cfg.ruleId(), t_rule_cfg.ruleName(),
               t_rule_cfg.flag(), t_rule_cfg.ruleParam())
        .from(t_rule_cfg).where(t_rule_cfg.aldId()==40);
  1. 使用exec<db_type>(sql_statement)函数执行sql语句其中查询的exec不同为exec(表名sql语句))
  2. 使用auto类型接受exec函数的执行结果,其中查询为表的行数组,其它为受影响的行数

注意事项

  1. 目前支持的数据库类型仅为db2
  2. 目前支持的数据类型包含 intdoublecharstringmix_cc::mix_time(对应db2中time_stamp)
  3. 目前字符不支持特殊字符需要更改对sqlapi++的使用方式