summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/pg_locale.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2000-08-29 04:41:48 +0000
committerBruce Momjian <bruce@momjian.us>2000-08-29 04:41:48 +0000
commitdffd8cac3dd8fb99ed4299bf2ef7eddba6eeaba2 (patch)
treede1078c4af77f5d1f5db078d86874145e2d8cb97 /src/backend/utils/adt/pg_locale.c
parentd4f626507ca56bf3e1a8adeea7f158535ddb0220 (diff)
* to_char:
- full support for IW (ISO week) and vice versa conversion for IW too (the to_char 'week' support is now complete and I hope correct). Thomas, I use for IW code from timestamp.c, for this I create separate function date2isoweek() from original 'case DTK_WEEK:' code in the timestamp_part(). I mean will better use one code for same feature in date_part() and in to_char(). The isoweek2date() is added to timestamp.c too. Right? IMHO in 7.1 will all to_char's features complete. It is cca 41 templates for date/time and cca 21 for numbers. * to_ascii: - gcc, is it correct now? :-) In the patch is documentation for to_char's IW and for to_ascii(). Karel
Diffstat (limited to 'src/backend/utils/adt/pg_locale.c')
-rw-r--r--src/backend/utils/adt/pg_locale.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index d176a8fd230..31e791170fe 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -2,7 +2,7 @@
/* -----------------------------------------------------------------------
* pg_locale.c
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_locale.c,v 1.5 2000/06/29 01:19:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_locale.c,v 1.6 2000/08/29 04:41:47 momjian Exp $
*
*
* Portions Copyright (c) 1999-2000, PostgreSQL, Inc
@@ -26,6 +26,8 @@
/* #define DEBUG_LOCALE_UTILS */
+static struct lconv *CurrentLocaleConv = NULL;
+
/*------
* Return in PG_LocaleCategories current locale setting
*------
@@ -119,7 +121,9 @@ struct lconv *
PGLC_localeconv(void)
{
PG_LocaleCategories lc;
- struct lconv *lconv;
+
+ if (CurrentLocaleConv)
+ return CurrentLocaleConv;
/* Save current locale setting to lc */
PGLC_current(&lc);
@@ -128,12 +132,12 @@ PGLC_localeconv(void)
setlocale(LC_ALL, "");
/* Get numeric formatting information */
- lconv = localeconv();
+ CurrentLocaleConv = localeconv();
/* Set previous original locale */
PGLC_setlocale(&lc);
- return lconv;
+ return CurrentLocaleConv;
}