[odb-users] mapping between long long and NUMERIC(18,0) type

Sten Kultakangas ratkaisut at gmail.com
Wed Sep 21 04:26:37 EDT 2016


Hello

We have legacy software that deals with MS SQL tables where primary
key and other fields are defined as numeric(18,0) instead of bigint. I
don't want to modify the definition of the tables. So far i have been
accessing the table without any problems using the following model:


PRAGMA_DB(object no_id schema("XXXDatabase.dbo"))
struct XXXTable {
//...
PRAGMA_DB(type("bigint"))
long long XXXduration;
//...
};

I do not read nor update the primary key so far. The question is: what
is the best place in libodb code to implement a conversion routine
between numeric(18,0) and "long long" ? It would be just a temporary
solution.

The generic solution would be to implement a generic conversion
routine between an arbitrary precision NUMERIC and
boost::multiprecision::number<cpp_dec_float<XXX>> type.

Best regards,
Sten Kultakangas



More information about the odb-users mailing list