1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Hi, here are the patches to enhance existing MB handling. This time

I have implemented a framework of encoding translation between the
backend and the frontend. Also I have added a new variable setting
command:

SET CLIENT_ENCODING TO 'encoding';

Other features include:
	Latin1 support more 8 bit cleaness

See doc/README.mb for more details. Note that the pacthes are
against May 30 snapshot.

Tatsuo Ishii
This commit is contained in:
Bruce Momjian
1998-06-16 07:29:54 +00:00
parent 0d8e7f6381
commit cb7cbc16fa
37 changed files with 1115 additions and 341 deletions

View File

@@ -4,7 +4,7 @@
# Makefile for commands
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/commands/Makefile,v 1.12 1998/04/06 00:22:19 momjian Exp $
# $Header: /cvsroot/pgsql/src/backend/commands/Makefile,v 1.13 1998/06/16 07:29:20 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -13,11 +13,19 @@ include ../../Makefile.global
CFLAGS += -I..
ifdef MB
CFLAGS += -DMB=$(MB)
endif
OBJS = async.o creatinh.o command.o copy.o defind.o define.o \
remove.o rename.o vacuum.o version.o view.o cluster.o \
recipe.o explain.o sequence.o trigger.o user.o proclang.o \
dbcommands.o variable.o
ifdef MB
OBJS += mbutils.o
endif
all: SUBSYS.o
SUBSYS.o: $(OBJS)

View File

@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements.
*
* $Id: variable.c,v 1.6 1998/06/15 19:28:17 momjian Exp $
* $Id: variable.c,v 1.7 1998/06/16 07:29:21 momjian Exp $
*
*/
@@ -15,6 +15,9 @@
#include "commands/variable.h"
#include "utils/builtins.h"
#include "optimizer/internal.h"
#ifdef MB
#include "regex/pg_wchar.h"
#endif
extern Cost _cpu_page_wight_;
extern Cost _cpu_index_page_wight_;
@@ -519,6 +522,54 @@ reset_timezone()
return TRUE;
} /* reset_timezone() */
#ifdef MB
/*-----------------------------------------------------------------------*/
bool
parse_client_encoding(const char *value)
{
int encoding;
encoding = pg_valid_client_encoding(value);
if (encoding < 0) {
elog(ERROR, "Client encoding %s is not supported", value);
} else {
if (pg_set_client_encoding(encoding)) {
elog(ERROR, "Conversion between %s and %s is not supported",
value, pg_encoding_to_char(MB));
}
}
return TRUE;
}
bool
show_client_encoding()
{
elog(NOTICE, "Current client encoding is %s",
pg_encoding_to_char(pg_get_client_encoding()));
return TRUE;
}
bool
reset_client_encoding()
{
int encoding;
char *env = getenv("PGCLIENTENCODING");
if (env) {
encoding = pg_char_to_encoding(env);
if (encoding < 0) {
encoding = MB;
}
} else {
encoding = MB;
}
pg_set_client_encoding(encoding);
return TRUE;
}
/*-----------------------------------------------------------------------*/
#endif
/*-----------------------------------------------------------------------*/
struct VariableParsers
{
@@ -547,6 +598,11 @@ struct VariableParsers
{
"r_plans", parse_r_plans, show_r_plans, reset_r_plans
},
#ifdef MB
{
"client_encoding", parse_client_encoding, show_client_encoding, reset_client_encoding
},
#endif
{
NULL, NULL, NULL, NULL
}