Re: ECPG patch: get descriptor did not use "C" locale while
От | Bruce Momjian |
---|---|
Тема | Re: ECPG patch: get descriptor did not use "C" locale while |
Дата | |
Msg-id | 200201231555.g0NFtJ509338@candle.pha.pa.us обсуждение исходный текст |
Ответ на | ECPG patch: get descriptor did not use "C" locale while parsing data (Christof Petig <christof@petig-baender.de>) |
Ответы |
Re: ECPG patch: get descriptor did not use "C" locale while
Re: ECPG patch: get descriptor did not use "C" locale while parsing data |
Список | pgsql-interfaces |
Is this a fix you want applied to 7.2 or 7.3? I am confused. Patch attached. --------------------------------------------------------------------------- Christof Petig wrote: > Hi Michael, > > The bug description is quite simple try to use get descriptor on a float > variable while LC_NUMERIC=de is active ... you get incorrectly formatted > float value. > > Please apply the fix. > > Yours > Christof > [ application/gzip is not supported, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026 Index: lib/descriptor.c =================================================================== 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); } else if (data_var.ind_type!=ECPGt_NO_INDICATOR) {
В списке pgsql-interfaces по дате отправления: