Re: [INTERFACES] [libpq] Return value of int

From: "D'Arcy" "J(dot)M(dot)" Cain <darcy(at)druid(dot)net>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] [libpq] Return value of int
Date: 1999-05-02 19:35:03
Message-ID: m10e211-0000bIC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Thus spake Tom Lane
> Henk Jan Barendregt <henkjan(at)barendregt(dot)xs4all(dot)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(at){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.

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message barreiro 1999-05-02 19:37:47 Error linking C++ code.
Previous Message barreiro 1999-05-02 18:31:06 Error linking C++ code.