pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: "D'Arcy" "J.M." Cain <darcy@druid.net>
To: tgl@sss.pgh.pa.us
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] [libpq] Return value of int
Date: Sun, 2 May 1999 15:35:03 -0400 (EDT)
Message-ID: <m10e211-0000bIC@druid.net> (raw)
In-Reply-To: <13408.925661516@sss.pgh.pa.us>

Thus spake Tom Lane
> Henk Jan Barendregt <henkjan@barendregt.xs4all.nl> writes:
> > How can i use libpq to return an int value when i access an INT or INT4
> > value
> 
> Use atoi() ... what comes out of libpq is a character string always.
> It's up to you to convert it to whatever form you want it in.

Regarding this, it would be nice if libpq had some official, documented
way of determining the type of the field.  Currently I deal with this
in PyGreSQL by stealing some #defines from src/include/catalog/pg_type.h,
something that isn't normally available to application programmers.  In
fact, maybe we just have to move those #defines into postgres.h or
something that is in the public include directory.

Just thinking out loud.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.



view thread (4+ messages)

Message-ID: <m10e211-0000bIC@druid.net>
Permalink:  ../m10e211-0000bIC@druid.net/
Also on:    postgresql.org/message-id/m10e211-0000bIC@druid.net

 · 

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: darcy@druid.net, tgl@sss.pgh.pa.us
  Subject: Re: [INTERFACES] [libpq] Return value of int
  In-Reply-To: <m10e211-0000bIC@druid.net>

* 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