Skip site navigation (1) Skip section navigation (2)

Re: Getting oid with libpq

From: "Johan C(dot) de Koning" <johan(dot)de(dot)koning(at)geodan(dot)nl>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <jtv(at)xs4all(dot)nl>
Cc: <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: Getting oid with libpq
Date: 2005-08-11 14:08:31
Message-ID: 20050811140905.1C7B552869@svr1.postgresql.org (view raw or flat)
Thread:
Lists: 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(at)sss(dot)pgh(dot)pa(dot)us] 
Verzonden: donderdag 11 augustus 2005 15:57
Aan: jtv(at)xs4all(dot)nl
CC: Johan C. de Koning; pgsql-interfaces(at)postgresql(dot)org
Onderwerp: Re: [INTERFACES] Getting oid with libpq

jtv(at)xs4all(dot)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





In response to

Responses

pgsql-interfaces by date

Next:From: Bruce MomjianDate: 2005-08-13 02:22:18
Subject: Re: [HACKERS] ECPG and escape strings
Previous:From: Tom LaneDate: 2005-08-11 13:57:24
Subject: Re: Getting oid with libpq

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group