Project

General

Profile

Using sql_value_traits with unsigned integers (uint64_t, uint32_t etc)

Added by Gavin Blakeman almost 2 years ago

I am not sure if I am missing something or not understanding. However the sql_value_traits do not appear to support unsigned values.

I would like to use unsigned values in the database that I am setting up, and have a specific preference to use unsigned values for keys.

When I attempt to specialise sql_value_traits for unsigned values, it looks like I would need to add/specialise SqlStatement for the unsigned values as well.

Am I missing something?


Replies (1)

RE: Using sql_value_traits with unsigned integers (uint64_t, uint32_t etc) - Added by Koen Deforche almost 2 years ago

Most databases do not support unsigned integer types (and the standard doesn't specify them), asfaik. The design of the Wt::Dbo is to model the data that can be stored in the database using appropriate types in C so that a one-on-one relationship exists at that level and the storage is fully compatible and transparent.

If you want to further treat the numbers as unsigned you thus need to cast in C.

    (1-1/1)