Re: libpq binary transfer of the numeric data type - II - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: libpq binary transfer of the numeric data type - II
Date
Msg-id 16572.1091489720@sss.pgh.pa.us
Whole thread Raw
In response to libpq binary transfer of the numeric data type - II  (Brijesh Shrivastav <Bshrivastav@esri.com>)
List pgsql-interfaces
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


pgsql-interfaces by date:

Previous
From: Brijesh Shrivastav
Date:
Subject: libpq binary transfer of the numeric data type - II
Next
From: Brijesh Shrivastav
Date:
Subject: Re: libpq binary transfer of the numeric data type -