Re: - pgaql long value corrupted using htons - Mailing list pgsql-interfaces

From Neeraj Rai
Subject Re: - pgaql long value corrupted using htons
Date
Msg-id 1369266903.47851.YahooMailNeo@web164904.mail.bf1.yahoo.com
Whole thread Raw
In response to - pgaql long value corrupted using htons  (Neeraj Rai <rneeraj@yahoo.com>)
List pgsql-interfaces

 testlibqp-dt.c  is attached



From: Neeraj Rai <rneeraj@yahoo.com>
To: "pgsql-interfaces@postgresql.org" <pgsql-interfaces@postgresql.org>
Sent: Wednesday, May 22, 2013 7:52 PM
Subject: [INTERFACES]- pgaql long value corrupted using htons

Hi,

1. I am having trouble writing long values via c interface .testlibqp-dt.c  is attached.
. 2 is being inserted as 8589934592.


qsf=> select * from t1;
   curdate   |  strf  |        intf        |         tm_new         | txnid 
------------+--------+--------------------+------------------------+-------
1999-01-10 | hello2 |8589934592 | 1999-01-08 04:05:06-05 |     3

I tried htobe64 but that didn't help either.
Any advise would be appreciated.

2. I have switched to using string for data and timestamp and it seems to work.

I found functions like TimestampTzGetDatum,time_t_to_timestamptz in the code 
But it seems they are not exposed to interface.
I have the date time in unix format (via time and gettimeofday). I would prefer to pass those values
in binary, rather than string format. Is there any option to do this ? Or is it easily addable?

thanks
Neeraj



Attachment

pgsql-interfaces by date:

Previous
From: Neeraj Rai
Date:
Subject: - pgaql long value corrupted using htons
Next
From: David Patimer
Date:
Subject: Building libpq for Windows 64bit