Re: Need Info - Mailing list pgsql-interfaces

From jtv
Subject Re: Need Info
Date
Msg-id 20020202120610.D25362@xs4all.nl
Whole thread Raw
In response to Need Info  (Shamik Majumder <shamik.majumder@wipro.com>)
Responses Re: Beating Oracle
List pgsql-interfaces
On Mon, Jan 28, 2002 at 12:15:20PM +0530, Shamik Majumder wrote:
> 
> My problem is - for my application, I need to have the values back in
> their proper format, that means if the datatyoe of one field is integer,
> I want to get it back as an integer type and not as a string.

Two ways:

1. Binary result sets.  This gets a little hairy because you'll need to
do your own conversion to your client platform's sizes, byte sex etc.
Documentation doesn't provide all that much in the way of details either.

2. Convert the strings to the right types yourself, using either sscanf()
or atoi() and its friends.  

Or if you happen to be writing in C++, you may want to check out my new
C++ frontend (currently in development but quite usable), which lets you
write stuff like
Result R = T.Exec("select number from mytable where id=123");int n;if (!R[0][0].to(n)) throw runtime_error("No number
set!");

You can find this library at
   http://members.ams.chello.nl/j.vermeulen31/proj-libpqxx.html


HTH,

Jeroen



pgsql-interfaces by date:

Previous
From: jtv
Date:
Subject: Re: having a whole lot of trouble...
Next
From: Bagyinszki Péter
Date:
Subject: passing open connections between processes