[odb-users] nullable unsigned variables

Soroush Rabiei soroush.rabiei at gmail.com
Sun Sep 6 06:53:31 EDT 2015


Hi

I have a problem using nullable types aka `odb::nullable'.  It seems it
can't handle `unsigned' variables. Here is a small test and it's output
error:

#include <odb/core.hxx>
> #include <odb/nullable.hxx>
> class foo
> {
>     friend class odb::access;
>     private:
>     odb::nullable<unsigned short int> x;
> };
> #pragma db object(foo) no_id table("foo_table")
> #pragma db member(foo::x) column("X")


I'm getting these errors:

g++ --std=c++11 -c -Wall -Wextra -Wno-unknown-pragmas --pedantic
> test-odb.cxx
> test-odb.cxx: In static member function ‘static void
> odb::access::object_traits_impl<foo,
> (odb::database_id)3u>::init(odb::access::object_traits_impl<foo,
> (odb::database_id)3u>::image_type&, const object_type&,
> odb::oracle::statement_kind)’:
> test-odb.cxx:70:30: error: no matching function for call to
> ‘odb::oracle::value_traits<odb::nullable<short unsigned int>,
> (odb::oracle::database_type_id)0u>::set_image(int&, bool&, const
> odb::nullable<short unsigned int>&)’
> test-odb.cxx:70:30: note: candidates are:
> In file included from test-odb.cxx:13:0:
> /usr/include/odb/oracle/traits.hxx:351:7: note: static void
> odb::oracle::wrapped_value_traits<W, ID,
> true>::set_image(odb::oracle::wrapped_value_traits<W, ID,
> true>::image_type&, bool&, const W&) [with W = odb::nullable<short unsigned
> int>; odb::oracle::database_type_id ID = (odb::oracle::database_type_id)0u;
> odb::oracle::wrapped_value_traits<W, ID, true>::image_type = unsigned int]
> /usr/include/odb/oracle/traits.hxx:351:7: note:   no known conversion for
> argument 1 from ‘int’ to
> ‘odb::oracle::wrapped_value_traits<odb::nullable<short unsigned int>,
> (odb::oracle::database_type_id)0u, true>::image_type& {aka unsigned int&}’
> /usr/include/odb/oracle/traits.hxx:373:7: note: static void
> odb::oracle::wrapped_value_traits<W, ID, true>::set_image(char*,
> std::size_t, std::size_t&, bool&, const W&) [with W = odb::nullable<short
> unsigned int>; odb::oracle::database_type_id ID =
> (odb::oracle::database_type_id)0u; std::size_t = long unsigned int]
> /usr/include/odb/oracle/traits.hxx:373:7: note:   candidate expects 5
> arguments, 3 provided
> /usr/include/odb/oracle/traits.hxx:388:7: note: static void
> odb::oracle::wrapped_value_traits<W, ID, true>::set_image(char*,
> std::size_t&, bool&, const W&) [with W = odb::nullable<short unsigned int>;
> odb::oracle::database_type_id ID = (odb::oracle::database_type_id)0u;
> std::size_t = long unsigned int]
> /usr/include/odb/oracle/traits.hxx:388:7: note:   candidate expects 4
> arguments, 3 provided
> /usr/include/odb/oracle/traits.hxx:408:7: note: static void
> odb::oracle::wrapped_value_traits<W, ID, true>::set_image(bool (*&)(const
> void*, ub4*, const void**, ub4*, odb::oracle::chunk_position*, void*, ub4),
> const void*&, bool&, const W&) [with W = odb::nullable<short unsigned int>;
> odb::oracle::database_type_id ID = (odb::oracle::database_type_id)0u;
> odb::oracle::param_callback_type = bool (*)(const void*, unsigned int*,
> const void**, unsigned int*, odb::oracle::chunk_position*, void*, unsigned
> int); ub4 = unsigned int]
> /usr/include/odb/oracle/traits.hxx:408:7: note:   candidate expects 4
> arguments, 3 provided
> make: *** [test-odb.o] Error 1


More information about the odb-users mailing list