Re: How do you convert PostgreSQL internal binary field to C datatypes

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Jeff Lynn <jmlynn(at)rogers(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: How do you convert PostgreSQL internal binary field to C datatypes
Date: 2007-05-22 19:24:06
Message-ID: 20070522192406.GG11032@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Jeff Lynn wrote:
> Does someone out there has some example(s) of converting the
> PostgreSQL's internal (network byte order) representation of float4,
> flost8, date, datetime and timestamp into Win32 float, double, CTime or
> any Win32 date/time construct under Intel x86 h/w architecture?
>
> Andrew McNamara in previous post suggested that there are answers in the
> server source codes. But for a beginner like me, even though I have
> extensive coding experience in C, C++ and Java, such undertaking for a
> significant product like PostgreSQL is a bit overwhelming for now.
>
> I really do want to explore the usage of PostgreSQL further! So any
> help will be greatly appreciated.

The code to handle these datatypes lies mostly here:
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/

For example, in float.c look for float4send which directs you to
pq_sendfloat4 which you can find in

http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/libpq/pqformat.c

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Andrew McNamara 2007-05-23 09:43:47 Re: Re: PQgetvalue failed to return column value for non-text data in binary format
Previous Message Jeff Lynn 2007-05-22 18:35:02 How do you convert PostgreSQL internal binary field to C datatypes