Please add cppdb::result::fetch(bool& value)
Brought to you by:
artyom-beilis
Please add a cppdb::result::fetch(bool& value) function.
I guess that bool is a common type in all databases.
We can fetch a bool as an int but in some situations it is annoying.
Thanks for great framework.
Anonymous
Naa,
i my case, every useable database has not this type.
Neither MySQL(MyISAM and InnoDB) nor SQLite has this type. It is a int (like in cpp) either 0 for false or 1 for true. Just cast that into a cpp boolean should work.
bool a = 1;
std::cout << !(a || false) << std::endl;
works great :)
+1 for bool type
PostgreSQL have boolean type and it's really lacking of it.
http://www.postgresql.org/docs/9.2/static/datatype-boolean.html
Marcel, I forget to mention that your syntax not working with syntactic sugar like:
bool b;
cppdb::result result = sql << "SELECT true::bool;" << cppdb::row;
result >> b;
+1 for bool type!
The attached incomplete patch file for PostgreSQL appears to be working for myself.