pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Jeff Lynn <jmlynn@rogers.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: How do you convert PostgreSQL internal binary field to C datatypes
Date: Tue, 22 May 2007 15:24:06 -0400
Message-ID: <20070522192406.GG11032@alvh.no-ip.org> (raw)
In-Reply-To: <465337D6.6080103@rogers.com>
References: <465337D6.6080103@rogers.com>

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.



view thread (6+ messages)  latest in thread

Message-ID: <20070522192406.GG11032@alvh.no-ip.org>
Permalink:  ../20070522192406.GG11032@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20070522192406.GG11032@alvh.no-ip.org

 · 

reply

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: alvherre@commandprompt.com, jmlynn@rogers.com
  Subject: Re: How do you convert PostgreSQL internal binary field to C datatypes
  In-Reply-To: <20070522192406.GG11032@alvh.no-ip.org>

* 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