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

Boris Kolpackov boris at codesynthesis.com
Wed Sep 21 21:31:46 EDT 2016


Hi Sten,

Sten Kultakangas <ratkaisut at gmail.com> writes:

> 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.

You actually don't need to do it directly in libodb (actually it would
have to be libodb-mssql) since ODB supports custom C++ to SQL type mapping,
as described in this article:

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

A few pointers about this specific case (all files mentioned are in
libodb-mssql):

1. The SQL type is id_decimal (defined in traits.hxx).

2. The image type is struct decimal (defined in mssql-fwd.hxx).

3. The binary format should be described in MSDN (see SQL_DECIMAL,
   SQL_NUMERIC_STRUCT).

Boris



More information about the odb-users mailing list