Beispiel #1
0
/*
 * We allow LC_MESSAGES to actually be set globally.
 *
 * Note: we normally disallow value = "" because it wouldn't have consistent
 * semantics (it'd effectively just use the previous value).  However, this
 * is the value passed for PGC_S_DEFAULT, so don't complain in that case,
 * not even if the attempted setting fails due to invalid environment value.
 * The idea there is just to accept the environment setting *if possible*
 * during startup, until we can read the proper value from postgresql.conf.
 */
const char *
locale_messages_assign(const char *value, bool doit, GucSource source)
{
	if (*value == '\0' && source != PGC_S_DEFAULT)
		return NULL;

	/*
	 * LC_MESSAGES category does not exist everywhere, but accept it anyway
	 *
	 * On Windows, we can't even check the value, so the non-doit case is a
	 * no-op
	 */
#ifdef LC_MESSAGES
	if (doit)
	{
		if (!pg_perm_setlocale(LC_MESSAGES, value))
			if (source != PGC_S_DEFAULT)
				return NULL;
	}
#ifndef WIN32
	else
		value = locale_xxx_assign(LC_MESSAGES, value, false, source);
#endif   /* WIN32 */
#endif   /* LC_MESSAGES */
	return value;
}
Beispiel #2
0
/*
 * We allow LC_MESSAGES to actually be set globally.
 */
const char *
locale_messages_assign(const char *value, bool doit, bool interactive)
{
	/*
	 * LC_MESSAGES category does not exist everywhere, but accept it
	 * anyway
	 */
#ifdef LC_MESSAGES
	if (doit)
	{
		if (!setlocale(LC_MESSAGES, value))
			return NULL;
	}
	else
		value = locale_xxx_assign(LC_MESSAGES, value, false, interactive);
#endif
	return value;
}
Beispiel #3
0
const char *
locale_time_assign(const char *value, bool doit, GucSource source)
{
	return locale_xxx_assign(LC_TIME, value, doit, source);
}
Beispiel #4
0
const char *
locale_numeric_assign(const char *value, bool doit, GucSource source)
{
	return locale_xxx_assign(LC_NUMERIC, value, doit, source);
}
Beispiel #5
0
const char *
locale_monetary_assign(const char *value, bool doit, GucSource source)
{
	return locale_xxx_assign(LC_MONETARY, value, doit, source);
}
Beispiel #6
0
const char *
locale_time_assign(const char *value, bool doit, bool interactive)
{
	return locale_xxx_assign(LC_TIME, value, doit, interactive);
}
Beispiel #7
0
const char *
locale_numeric_assign(const char *value, bool doit, bool interactive)
{
	return locale_xxx_assign(LC_NUMERIC, value, doit, interactive);
}
Beispiel #8
0
const char *
locale_monetary_assign(const char *value, bool doit, bool interactive)
{
	return locale_xxx_assign(LC_MONETARY, value, doit, interactive);
}