Menu

#4 Please add cppdb::result::fetch(bool& value)

open
nobody
None
5
2015-04-25
2011-05-20
Anonymous
No

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.

Discussion

  • Marcel Hellwig

    Marcel Hellwig - 2011-12-26

    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 :)

     
  • Sergey Lavrov

    Sergey Lavrov - 2013-02-12

    +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

     
  • Sergey Lavrov

    Sergey Lavrov - 2013-02-12

    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;

     
  • CN Liou

    CN Liou - 2015-04-25

    +1 for bool type!

    The attached incomplete patch file for PostgreSQL appears to be working for myself.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.