From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Sudheer H R <sudheer.hr@tekenlight.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Question about how to handle numeric (decimal) data types while using libpq
Date: Tue, 6 Jul 2021 14:29:37 +0200
Message-ID: <e3edc85a-3b03-8564-439b-01509b47d637@enterprisedb.com> (raw)
In-Reply-To: <63A4A360-8A41-476B-A5B6-D00088D6F590@tekenlight.com>
References: <63A4A360-8A41-476B-A5B6-D00088D6F590@tekenlight.com>
On 06.07.21 13:04, Sudheer H R wrote:
> I am trying to use libpq for interfacing with PostgreSQL from a C/C++ based application.
>
> I have tried to use binary format of data for both sending and receiving data to and from server (resultFormat = 1).
>
> As I understand most binary types, int, float etc… are encoded in bing-endian byte order and they can be converted to appropriate host specific memory representations.
>
> However NUMERIC datatype is a more complex structure with multiple ints and pointers.
>
> I would like to know if there are published library functions that convert (to and from) NUMERIC field to say, long double datatype
There is a third-party library called libpqtypes out there that adds
support for handling specific types on the libpq side. But I'm not sure
how up to date it is.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: peter.eisentraut@enterprisedb.com, sudheer.hr@tekenlight.com
Subject: Re: Question about how to handle numeric (decimal) data types while using libpq
In-Reply-To: <e3edc85a-3b03-8564-439b-01509b47d637@enterprisedb.com>
References: <63A4A360-8A41-476B-A5B6-D00088D6F590@tekenlight.com> <e3edc85a-3b03-8564-439b-01509b47d637@enterprisedb.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox