[odb-users] About MySQL type decimal
boris at codesynthesis.com
Thu Feb 4 04:20:15 EST 2016
Aarón Bueno Villares <abv150ci at gmail.com> writes:
> If I define the type of a field as a `DECIMAL(4, 2)` (for a MySQL engine),
> what must be the C++ type of that field, `string`, `float`/`double` or
> both? Because the docs says nothing about decimals.
Added to the manual:
"The only built-in mapping provided for the MySQL DECIMAL type is to
std::string/char[N], for example:
#pragma db object
#pragma db type ("DECIMAL(6,3)")
You can, however, map DECIMAL to a custom C++ type by providing a suitable
> Does ODB also test or round the value of the field?
No. It just puts whatever MySQL sent into the string and similarly sends
to MySQL whatever you put into the string.
More information about the odb-users