From: | Jim Mercer <jim(at)reptiles(dot)org> |
---|---|
To: | Nelio Alves Pereira Filho <nelio(at)ifx(dot)com(dot)br> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: libpq: Char to INT |
Date: | 2000-11-09 16:24:28 |
Message-ID: | 20001109112428.P16128@reptiles.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Nov 09, 2000 at 02:03:47PM -0200, Nelio Alves Pereira Filho wrote:
> I want to do a query that returns an integer and then fetch the result
> as an int. My query is something like that:
>
> SELECT 1::int
>
> Normally, I would get the result as a char and then convert it to int.
> Until here, no misteries. However, 'The Programmer's Guide' shows an
> example where a char pointer is converted to an int pointer, and then
> it's used normally. I tried that, but the result wasn't correct..
>
> Just to mention, I 'm used to convert char to int with strtol.
i generally do:
int num;
num = atoi(PQgetvalue(query_ptr, recnum, fnum));
--
[ Jim Mercer jim(at)reptiles(dot)org +1 416 410-5633 ]
[ Reptilian Research -- Longer Life through Colder Blood ]
[ Don't be fooled by cheap Finnish imitations; BSD is the One True Code. ]
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2000-11-09 16:33:53 | Re: need an information on PostgreSQL |
Previous Message | Dan Moschuk | 2000-11-09 16:23:27 | More vacuum troubles |