[odb-users] Compilation error when using decimal(p, s) or bytea types

Boris Kolpackov boris at codesynthesis.com
Sun Mar 24 09:03:04 EDT 2019


Sam <lists1 at afach.de> writes:

>    #ifdef ODB_COMPILER
>    #pragma db default("0") column("Balance") type("decimal(8,8)")
>    #endif
>        std::string balance;
>
>    The error is the following:
> 
>    /home/user/temp/build-odb_test-Default_cmake-Default/OrmBalancesClass_
>    ODB_generated/OrmBalances-odb.cxx:206: error: too many arguments to
>    function call, expected 3, have 4; did you mean
>    'pgsql::c_string_value_traits::set_image'?
>          pgsql::value_traits<
>          ^~~~~
>          pgsql::c_string_value_traits::set_image
> 
>    Is this a bug or am I doing something wrong?

There is no built-in mapping for Postgres decimal type to std::string.
All the available built-in mappings are described in the manual,
specifically, Section 19.1, "PostgreSQL Type Mapping". You can also
add support for a custom mapping as described in this blog post:

https://www.codesynthesis.com/~boris/blog/2012/10/16/custom-cxx-to-database-type-mapping-in-odb/



More information about the odb-users mailing list