qicosmos / ormpp

modern C++ ORM, C++17, support mysql, postgresql,sqlite
Apache License 2.0
1.2k stars 260 forks source link

pg boolean 类型兼容问题 #139

Closed Soliiiii closed 4 months ago

Soliiiii commented 6 months ago

当我尝试在struct中定义 bool变量并query pg数据库时,我发现获得的值总是0(false)。 看起来问题的原因是头文件postgresql.hpp中没有为bool类型定义单独的assign函数(源码534行),因此bool类型会被按照integral类型解析。但不幸的是pg select一个boolean类型时其输出的是字符t/f。因此其总会被解析为0。 请问有什么好的处理方式解决该问题吗? 我希望C++struct中的变量类型为bool而pg DDL中类型为boolean。 我的处理方式是在assign函数中加了如下两行: 图片

Jacyking commented 6 months ago

140 fixed