Received: from druid.net (root@druid.net [198.96.119.226]) by hub.org (8.9.3/8.9.3) with ESMTP id PAA82735 for ; Sun, 2 May 1999 15:35:05 -0400 (EDT) (envelope-from darcy@druid.net) Received: from localhost (1559 bytes) by druid.net via sendmail with P:stdio/R:bind_hosts/T:inet_zone_bind_smtp (sender: ) (ident using unix) id for ; Sun, 2 May 1999 15:35:03 -0400 (EDT) (Smail-3.2.0.104 1998-Nov-20 #4 built 1999-Apr-13) Message-Id: Subject: Re: [INTERFACES] [libpq] Return value of int In-Reply-To: <13408.925661516@sss.pgh.pa.us> from Tom Lane at "May 2, 1999 12:11:56 pm" To: tgl@sss.pgh.pa.us (Tom Lane) Date: Sun, 2 May 1999 15:35:03 -0400 (EDT) From: "D'Arcy" "J.M." Cain Cc: pgsql-interfaces@postgreSQL.org Reply-To: pgsql-interfaces@postgreSQL.org X-Mailer: ELM [version 2.4ME+ PL50 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Thus spake Tom Lane > Henk Jan Barendregt 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 | 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.