Re: ECPG patch: get descriptor did not use "C" locale while - Mailing list pgsql-interfaces

From Bernhard Herzog
Subject Re: ECPG patch: get descriptor did not use "C" locale while
Date
Msg-id 6qofjl10su.fsf@abnoba.intevation.de
Whole thread Raw
In response to Re: ECPG patch: get descriptor did not use "C" locale while  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-interfaces
Bruce Momjian <pgman@candle.pha.pa.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/


pgsql-interfaces by date:

Previous
From: Christof Petig
Date:
Subject: Re: ECPG patch: get descriptor did not use "C" locale while parsing data
Next
From: Michael Meskes
Date:
Subject: Re: ECPG patch: get descriptor did not use "C" locale while parsing data