pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Johan C. de Koning <johan.de.koning@geodan.nl>
To: 'Tom Lane' <tgl@sss.pgh.pa.us>
To: jtv@xs4all.nl
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Getting oid with libpq
Date: Thu, 11 Aug 2005 16:08:31 +0200
Message-ID: <20050811140905.1C7B552869@svr1.postgresql.org> (raw)
In-Reply-To: <21817.1123768644@sss.pgh.pa.us>

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







view thread (7+ messages)  latest in thread

Message-ID: <20050811140905.1C7B552869@svr1.postgresql.org>
Permalink:  ../20050811140905.1C7B552869@svr1.postgresql.org/
Also on:    postgresql.org/message-id/20050811140905.1C7B552869@svr1.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: johan.de.koning@geodan.nl, tgl@sss.pgh.pa.us, jtv@xs4all.nl
  Subject: Re: Getting oid with libpq
  In-Reply-To: <20050811140905.1C7B552869@svr1.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox