[odb-users] PostgreSQL BIGINT Storage Value

Mike Ruffing mike.ruffing at ipconfigure.com
Wed Jul 2 13:06:58 EDT 2014


Boris,

Endianness was the issue.  Using hton and ntoh fixed the issue.  

Thanks for the help.

Mike 
________________________________________
From: Boris Kolpackov <boris at codesynthesis.com>
Sent: Wednesday, July 02, 2014 10:42 AM
To: Mike Ruffing
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] PostgreSQL BIGINT Storage Value

Hi Mike,

Mike Ruffing <mike.ruffing at ipconfigure.com> writes:

> Could this be a bit shift or endianness issue?

Yes, that's the most likely cause. PG want it in big-endian. You
can use:

#include <odb/pgsql/details/endian-traits.hxx>

odb::pgsql::details::endian_traits::ntoh()
odb::pgsql::details::endian_traits::hton()

See odb/pgsql/traits.hxx lines 356-397 for how standard integers
are handled using these functions.

Boris



More information about the odb-users mailing list