Re: ECPG patch: get descriptor did not use "C" locale while

From: Bernhard Herzog <bh(at)intevation(dot)de>
To: Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: ECPG patch: get descriptor did not use "C" locale while
Date: 2002-01-23 16:37:05
Message-ID: 6qofjl10su.fsf@abnoba.intevation.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:

> RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/lib/descriptor.c,v
> retrieving revision 1.21
> diff -u -r1.21 descriptor.c
> --- lib/descriptor.c 2002/01/11 14:43:11 1.21
> +++ lib/descriptor.c 2002/01/23 15:32:54
> @@ -330,11 +330,18 @@
> if (data_var.type!=ECPGt_EORT)
> {
> struct statement stmt;
> + char *oldlocale;
> +
> + /* Make sure we do NOT honor the locale for numeric input */
> + /* since the database gives the standard decimal point */
> + oldlocale = strdup(setlocale(LC_NUMERIC, NULL));
> + setlocale(LC_NUMERIC, "C");
> memset (&stmt, 0, sizeof stmt);
> stmt.lineno=lineno;
> /* desparate try to guess something sensible */
> stmt.connection=ECPGget_connection(NULL);
> ECPGstore_result(ECPGresult, index, &stmt, &data_var);
> + setlocale(LC_NUMERIC, oldlocale);

There should be a free(oldlocale); here, I think.

> }

Bernhard

--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://mapit.de/

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Meskes 2002-01-23 16:43:22 Re: ECPG patch: get descriptor did not use "C" locale while parsing data
Previous Message Michael Meskes 2002-01-23 16:35:58 Re: ECPG patch: get descriptor did not use "C" locale while parsing data