Re: Need Info

Поиск
Список
Период
Сортировка
От jtv
Тема Re: Need Info
Дата
Msg-id 20020202120610.D25362@xs4all.nl
обсуждение исходный текст
Ответ на Need Info  (Shamik Majumder <shamik.majumder@wipro.com>)
Ответы Re: Beating Oracle  (<jtv@xs4all.nl>)
Список 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 по дате отправления:

Предыдущее
От: jtv
Дата:
Сообщение: Re: having a whole lot of trouble...
Следующее
От: Bagyinszki Péter
Дата:
Сообщение: passing open connections between processes