Re: Getting oid with libpq - Mailing list pgsql-interfaces

From Johan C. de Koning
Subject Re: Getting oid with libpq
Date
Msg-id 20050811140905.1C7B552869@svr1.postgresql.org
Whole thread Raw
In response to Re: Getting oid with libpq  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Getting oid with libpq  (jtv@xs4all.nl)
List pgsql-interfaces
I tried to use atol but i get always 0 as result. Is this because I use a
binary cursor to select the data (there are some PostGIS datatypes inside my
resultset which are binary data).

Best regards,

Johan de Koning

-----Oorspronkelijk bericht-----
Van: Tom Lane [mailto:tgl@sss.pgh.pa.us] 
Verzonden: donderdag 11 augustus 2005 15:57
Aan: jtv@xs4all.nl
CC: Johan C. de Koning; pgsql-interfaces@postgresql.org
Onderwerp: Re: [INTERFACES] Getting oid with libpq

jtv@xs4all.nl writes:
>   const char *OldLocale = setlocale(LC_NUMERIC, "C");
> Then run the pointer returned by PQgetValue() through atol() to get a
> numeric value, and finally restore the previous locale with
>   setlocale(LC_NUMERIC, OldLocale);

Uh ... there is nothing at all locale-sensitive about atol, nor strtoul
which is what you really want to use for an OID.
        regards, tom lane






pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: Getting oid with libpq
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] ECPG and escape strings