From: Tom Lane <tgl@sss.pgh.pa.us>
To: Brijesh Shrivastav <Bshrivastav@esri.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: libpq binary transfer of the numeric data type - II
Date: Mon, 02 Aug 2004 19:35:20 -0400
Message-ID: <16572.1091489720@sss.pgh.pa.us> (raw)
In-Reply-To: <491DC5F3D279CD4EB4B157DDD62237F404E27FE9@zipwire.esri.com>
References: <491DC5F3D279CD4EB4B157DDD62237F404E27FE9@zipwire.esri.com>
Brijesh Shrivastav <Bshrivastav@esri.com> writes:
> Has anyone had success with fetching numeric data in binary format?
> I tried to follow Tom's advice below and try to reverse engineer from
> recv/send function. It seemes the end structure that user will
> get is of Numeric type (see struct below)
No, it isn't. What you get is a series of int16 fields:
pq_sendint(&buf, x.ndigits, sizeof(int16));
pq_sendint(&buf, x.weight, sizeof(int16));
pq_sendint(&buf, x.sign, sizeof(int16));
pq_sendint(&buf, x.dscale, sizeof(int16));
for (i = 0; i < x.ndigits; i++)
pq_sendint(&buf, x.digits[i], sizeof(NumericDigit));
Note that the "digits" are base-10000 digits.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: tgl@sss.pgh.pa.us, Bshrivastav@esri.com
Subject: Re: libpq binary transfer of the numeric data type - II
In-Reply-To: <16572.1091489720@sss.pgh.pa.us>
* 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