diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 89045b0dad55116d16dbd30d72e1accc9ba49ed3..555066e2811e7b4ad3ba7219e304fbed6db8f390 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.44 1998/07/24 03:31:04 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.45 1998/07/26 04:30:15 scrappy Exp $ # # NOTES # Essentially all Postgres make files include this file and use the @@ -151,7 +151,10 @@ X11_LIBS= -lX11 @X_EXTRA_LIBS@ # enable multi-byte support # choose one of: # EUC_JP,EUC_CN,EUC_KR,EUC_TW,UNICODE,MULE_INTERNAL,LATIN1-5 -MB=@MB@ +MULTIBYTE=@MULTIBYTE@ +ifdef MULTIBYTE +MBFLAGS = -DMULTIBYTE=$(MULTIBYTE) +endif ############################################################################## # diff --git a/src/backend/access/common/Makefile b/src/backend/access/common/Makefile index 76974644fa6b8344b1edfaf43e9151bf5a42e2f5..5b188808e87a55dafca87d92d09dbca33359c062 100644 --- a/src/backend/access/common/Makefile +++ b/src/backend/access/common/Makefile @@ -4,7 +4,7 @@ # Makefile for access/common # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/access/common/Makefile,v 1.11 1998/06/16 07:29:18 momjian Exp $ +# $Header: /cvsroot/pgsql/src/backend/access/common/Makefile,v 1.12 1998/07/26 04:30:16 scrappy Exp $ # #------------------------------------------------------------------------- @@ -13,8 +13,8 @@ include ../../../Makefile.global CFLAGS+=-I../.. -ifdef MB -CFLAGS+= -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = heaptuple.o heapvalid.o indextuple.o indexvalid.o printtup.o \ diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index 37a45b4cc6b0a0bdeb0a829f2fb189ab79fcd0f8..c07a2f9c978c7be1dd7123eabefb32215c6d0c89 100644 --- a/src/backend/access/common/printtup.c +++ b/src/backend/access/common/printtup.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.30 1998/07/18 18:34:01 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.31 1998/07/26 04:30:16 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -24,7 +24,7 @@ #include <utils/syscache.h> #ifdef MULTIBYTE -#include <commands/variable.h> +#include <mb/pg_wchar.h> #endif /* ---------------------------------------------------------------- diff --git a/src/backend/bootstrap/Makefile b/src/backend/bootstrap/Makefile index a3e8fa168586716aa5ebe9fec45eae95eaaa5f40..ccf8f46a242857e2722f98021acdb1e179be83a7 100644 --- a/src/backend/bootstrap/Makefile +++ b/src/backend/bootstrap/Makefile @@ -4,7 +4,7 @@ # Makefile for the bootstrap module # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.14 1998/07/24 03:31:06 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.15 1998/07/26 04:30:17 scrappy Exp $ # # # We must build bootparse.c and bootscanner.c with yacc and lex and sed, @@ -22,8 +22,8 @@ SRCDIR= ../.. include ../../Makefile.global CFLAGS += -I.. -ifdef MB -CFLAGS += -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif ifeq ($(CC), gcc) diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index 470d16b10158abd4c512bc329a3de3eaf32ac1fc..44a5b0519479f7bbfe3ba14d7ed23c92adfa3717 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.17 1998/07/24 03:31:07 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.18 1998/07/26 04:30:18 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -31,7 +31,7 @@ #include "bootstrap/bootstrap.h" #include "catalog/heap.h" #include "catalog/pg_am.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_attribute_mb.h" #include "catalog/pg_class_mb.h" #else diff --git a/src/backend/bootstrap/bootscanner.l b/src/backend/bootstrap/bootscanner.l index c3364c08735a6a697afcdcf717e7b302e0938bbb..a97fb7fc5715a8a5c031b133f8c94540812ad00d 100644 --- a/src/backend/bootstrap/bootscanner.l +++ b/src/backend/bootstrap/bootscanner.l @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.9 1998/07/24 03:31:08 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.10 1998/07/26 04:30:19 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,7 @@ #include "storage/block.h" #include "storage/off.h" #include "storage/itemptr.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_attribute_mb.h" #else #include "catalog/pg_attribute.h" @@ -32,7 +32,7 @@ #include "access/funcindex.h" #include "storage/fd.h" #include "catalog/pg_am.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_class_mb.h" #else #include "catalog/pg_class.h" diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index b5fa5e1952aaaff323f343c948de482e65fc1156..4be46d37daf7275fed04fa712376511ab502596f 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -7,7 +7,7 @@ * Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.45 1998/07/24 03:31:08 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.46 1998/07/26 04:30:19 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -41,7 +41,7 @@ #include "catalog/catname.h" #include "catalog/index.h" #include "catalog/pg_am.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_attribute_mb.h" #include "catalog/pg_class_mb.h" #else diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile index 79c38a8928e944006ef2a950529c7164cb5cd7b7..9c444da559507f53bb95a81460497e21c68c76db 100644 --- a/src/backend/catalog/Makefile +++ b/src/backend/catalog/Makefile @@ -4,7 +4,7 @@ # Makefile for catalog # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.11 1998/07/24 03:31:09 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.12 1998/07/26 04:30:20 scrappy Exp $ # #------------------------------------------------------------------------- @@ -24,7 +24,7 @@ SUBSYS.o: $(OBJS) GENBKI= ./genbki.sh -ifdef MB +ifdef MULTIBYTE GLOBALBKI_SRCS= $(addprefix ../../include/catalog/, \ pg_database_mb.h pg_variable.h pg_shadow.h \ pg_group.h pg_log.h \ @@ -36,7 +36,7 @@ GLOBALBKI_SRCS= $(addprefix ../../include/catalog/, \ ) endif -ifdef MB +ifdef MULTIBYTE LOCALBKI_SRCS= $(addprefix ../../include/catalog/, \ pg_proc.h pg_type.h pg_attribute_mb.h pg_class_mb.h \ pg_inherits.h pg_index.h pg_version.h pg_statistic.h \ diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile index 66e8f9a490e20f587f4d4cdffa3f95f01c2bb921..36c672a4d2b1770474df9c6605b94799d1b3d8b0 100644 --- a/src/backend/commands/Makefile +++ b/src/backend/commands/Makefile @@ -4,7 +4,7 @@ # Makefile for commands # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/commands/Makefile,v 1.14 1998/07/24 03:31:11 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/commands/Makefile,v 1.15 1998/07/26 04:30:22 scrappy Exp $ # #------------------------------------------------------------------------- @@ -13,8 +13,8 @@ include ../../Makefile.global CFLAGS += -I.. -ifdef MB -CFLAGS += -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = async.o creatinh.o command.o copy.o defind.o define.o \ diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 10a2fca34c164da2f6f3f4722ccf98467b0abb71..e95c3d7ed05a101f178d591d1e02257e2de57401 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.24 1998/07/24 03:31:13 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.25 1998/07/26 04:30:22 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -43,7 +43,7 @@ #include <utils/excid.h> #include <utils/mcxt.h> #include <catalog/pg_proc.h> -#ifdef MB +#ifdef MULTIBYTE #include <catalog/pg_class_mb.h> #else #include <catalog/pg_class.h> diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 23af759af4cddfc2bf3b6b349d047c038b99521a..6789fd0696d12de7d0fcbb617db97cfeed1ddf4c 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -6,7 +6,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.50 1998/07/24 03:31:14 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.51 1998/07/26 04:30:23 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -37,7 +37,7 @@ #include "commands/trigger.h" #include <storage/fd.h> -#ifdef MB +#ifdef MULTIBYTE #include "mb/pg_wchar.h" #endif @@ -1016,14 +1016,14 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim) char c; int done = 0; int i = 0; -#ifdef MB +#ifdef MULTIBYTE int mblen; int encoding; unsigned char s[2]; int j; #endif -#ifdef MB +#ifdef MULTIBYTE encoding = pg_get_client_encoding(); s[1] = 0; #endif @@ -1129,7 +1129,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim) } if (!done) { attribute[i++] = c; -#ifdef MB +#ifdef MULTIBYTE s[0] = c; mblen = pg_encoding_mblen(encoding, s); mblen--; @@ -1145,7 +1145,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim) elog(ERROR, "CopyReadAttribute - attribute length too long. line: %d", lineno); } attribute[i] = '\0'; -#ifdef MB +#ifdef MULTIBYTE return(pg_client_to_server((unsigned char*)attribute, strlen(attribute))); #else return (&attribute[0]); @@ -1157,20 +1157,20 @@ CopyAttributeOut(FILE *fp, unsigned char *server_string, char *delim, int is_arr { unsigned char *string; unsigned char c; -#ifdef MB +#ifdef MULTIBYTE int mblen; int encoding; int i; #endif -#ifdef MB +#ifdef MULTIBYTE string = pg_server_to_client(server_string, strlen(server_string)); encoding = pg_get_client_encoding(); #else string = server_string; #endif -#ifdef MB +#ifdef MULTIBYTE for (; (mblen = pg_encoding_mblen(encoding, string)) && ((c = *string) != '\0'); string += mblen) #else @@ -1197,7 +1197,7 @@ CopyAttributeOut(FILE *fp, unsigned char *server_string, char *delim, int is_arr fputc('\\', fp); } } -#ifdef MB +#ifdef MULTIBYTE for (i=0;i<mblen;i++) { fputc(*(string+i), fp); } diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index c2518b5a613cc8521c2177402432a39c1dc62803..bfaa6e0294be585e7ab018cfee8f87fc4ef8c343 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.16 1998/07/24 03:31:15 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.17 1998/07/26 04:30:24 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -22,7 +22,7 @@ #include "access/htup.h" #include "access/relscan.h" #include "catalog/catname.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_database_mb.h" #else #include "catalog/pg_database.h" @@ -47,7 +47,7 @@ static HeapTuple get_pg_dbtup(char *command, char *dbname, Relation dbrel); static void stop_vacuum(char *dbpath, char *dbname); void -#ifdef MB +#ifdef MULTIBYTE createdb(char *dbname, char *dbpath, int encoding) #else createdb(char *dbname, char *dbpath) @@ -98,7 +98,7 @@ createdb(char *dbname, char *dbpath) dbname, user_id, dbname); #endif -#ifdef MB +#ifdef MULTIBYTE sprintf(buf, "insert into pg_database (datname, datdba, encoding, datpath)" " values (\'%s\', \'%d\', \'%d\', \'%s\');", dbname, user_id, encoding, loc); #else diff --git a/src/backend/commands/rename.c b/src/backend/commands/rename.c index ef082f9dfdeae154f43c1840602c4f16e5214192..d893f9f119c8a4543d674579817a8179acfc1443 100644 --- a/src/backend/commands/rename.c +++ b/src/backend/commands/rename.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.12 1998/07/24 03:31:19 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.13 1998/07/26 04:30:24 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -30,7 +30,7 @@ #include <utils/excid.h> #include <utils/mcxt.h> #include <catalog/pg_proc.h> -#ifdef MB +#ifdef MULTIBYTE #include <catalog/pg_class_mb.h> #else #include <catalog/pg_class.h> diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index 08088eb4b7f43f8c6a3282e20ad6fe6723cc324b..a7849d85fe0ac8602739cd7bd5dec9df67acbe7a 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -20,7 +20,7 @@ #include <miscadmin.h> #include <catalog/catname.h> -#ifdef MB +#ifdef MULTIBYTE #include <catalog/pg_database_mb.h> #else #include <catalog/pg_database.h> diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 61375a0b8c600dd4226f660dccf422fe842aad96..79c0c9bbf61a093ee3b56cf1d30295ed99c159a5 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.67 1998/07/24 03:31:20 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.68 1998/07/26 04:30:25 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -27,7 +27,7 @@ #include "catalog/catalog.h" #include "catalog/catname.h" #include "catalog/index.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_class_mb.h" #else #include "catalog/pg_class.h" diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index 26070b7c7ded2efcf9f72c4da859df7434bc5b8e..2e59fd05dd41a0b822d8dd782ed6eca76222ecaf 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -2,7 +2,7 @@ * Routines for handling of 'SET var TO', * 'SHOW var' and 'RESET var' statements. * - * $Id: variable.c,v 1.9 1998/07/24 03:31:20 scrappy Exp $ + * $Id: variable.c,v 1.10 1998/07/26 04:30:26 scrappy Exp $ * */ @@ -16,7 +16,7 @@ #include "utils/builtins.h" #include "optimizer/internal.h" #ifdef MULTIBYTE -#include "regex/pg_wchar.h" +#include "mb/pg_wchar.h" #endif extern Cost _cpu_page_wight_; @@ -522,54 +522,6 @@ reset_timezone() return TRUE; } /* reset_timezone() */ -#ifdef MULTIBYTE -/*-----------------------------------------------------------------------*/ -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(MULTIBYTE)); - } - } - 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 = MULTIBYTE; - } - } else { - encoding = MULTIBYTE; - } - pg_set_client_encoding(encoding); - return TRUE; -} - -/*-----------------------------------------------------------------------*/ -#endif - /*-----------------------------------------------------------------------*/ struct VariableParsers { diff --git a/src/backend/libpq/Makefile b/src/backend/libpq/Makefile index 5176f2996a8f7b64869740b02099e534e7002a7f..d75c2d53f8f20875ce5d40db554e036bba937ca0 100644 --- a/src/backend/libpq/Makefile +++ b/src/backend/libpq/Makefile @@ -4,7 +4,7 @@ # Makefile for libpq subsystem (backend half of libpq interface) # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.12 1998/06/16 07:29:22 momjian Exp $ +# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.13 1998/07/26 04:30:27 scrappy Exp $ # #------------------------------------------------------------------------- @@ -19,8 +19,8 @@ CFLAGS+= $(KRBFLAGS) LDFLAGS+= $(KRBLIBS) endif -ifdef MB -CFLAGS+= -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = be-dumpdata.o be-fsstubs.o be-pqexec.o pqcomprim.o\ diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index 6ba66d08758c9beba94f99bfd0106ed808b984e8..56f0fd658e99a40969c90891c09e56c3fda7f14c 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.49 1998/07/18 18:34:03 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.50 1998/07/26 04:30:28 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -68,7 +68,7 @@ #include "libpq/libpq.h" /* where the declarations go */ #include "storage/ipc.h" #ifdef MULTIBYTE -#include "commands/variable.h" +#include "mb/pg_wchar.h" #endif /* ---------------- diff --git a/src/backend/parser/Makefile b/src/backend/parser/Makefile index 2ee71b738084f2102cd7ada2170dee180e57206c..8fb817c91ff76dc8d9a74ff243f0cef279a5b74a 100644 --- a/src/backend/parser/Makefile +++ b/src/backend/parser/Makefile @@ -4,7 +4,7 @@ # Makefile for parser # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.18 1998/07/24 03:31:21 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.19 1998/07/26 04:30:30 scrappy Exp $ # #------------------------------------------------------------------------- @@ -17,8 +17,8 @@ ifeq ($(CC), gcc) CFLAGS+= -Wno-error endif -ifdef MB -CFLAGS+= -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS= analyze.o gram.o keywords.o parser.o parse_agg.o parse_clause.o \ diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index bb06c854f7285041ff8d911ca60ee9616226fcf9..0d3924590e5f3a7ab7be25bbd835c24484a8e4b7 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.18 1998/07/26 01:18:04 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.19 1998/07/26 04:30:31 scrappy Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -46,7 +46,7 @@ #include "utils/elog.h" #include "access/xact.h" -#ifdef MB +#ifdef MULTIBYTE #include "mb/pg_wchar.h" #endif @@ -2084,7 +2084,7 @@ CreatedbStmt: CREATE DATABASE database_name WITH opt_database1 opt_database2 } n->dbname = $3; n->dbpath = $5; -#ifdef MB +#ifdef MULTIBYTE if ($6 != NULL) { n->encoding = pg_char_to_encoding($6); if (n->encoding < 0) { @@ -2103,7 +2103,7 @@ CreatedbStmt: CREATE DATABASE database_name WITH opt_database1 opt_database2 CreatedbStmt *n = makeNode(CreatedbStmt); n->dbname = $3; n->dbpath = NULL; -#ifdef MB +#ifdef MULTIBYTE n->encoding = GetTemplateEncoding(); #endif $$ = (Node *)n; diff --git a/src/backend/regex/Makefile b/src/backend/regex/Makefile index 1d1a9ac4f689271ff322143d8dc626f3fc8aa203..88d81f60ab32e26bbee9c9d6883ae6b7f93a1329 100644 --- a/src/backend/regex/Makefile +++ b/src/backend/regex/Makefile @@ -4,7 +4,7 @@ # Makefile for regex # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/regex/Makefile,v 1.7 1998/07/24 03:31:24 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/regex/Makefile,v 1.8 1998/07/26 04:30:34 scrappy Exp $ # #------------------------------------------------------------------------- @@ -15,8 +15,8 @@ CFLAGS += -I.. CFLAGS += -DPOSIX_MISTAKE OBJS = regcomp.o regerror.o regexec.o regfree.o -ifdef MB -CFLAGS += -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif all: SUBSYS.o diff --git a/src/backend/regex/engine.c b/src/backend/regex/engine.c index 43988b6dbd8673d5ca0a2773045cf884c36119f5..4c51fa5addca7dd7f9ec829714488b0b59be9af3 100644 --- a/src/backend/regex/engine.c +++ b/src/backend/regex/engine.c @@ -118,19 +118,8 @@ extern "C" #define CODEMAX (BOL+5) /* highest code used */ #ifdef MULTIBYTE -# if MULTIBYTE == MULE_INTERNAL -# define NONCHAR(c) ((c) > 16777216) /* 16777216 == 2^24 == 3 bytes */ -# define NNONCHAR (CODEMAX-16777216) -# elif MULTIBYTE == EUC_JP || MULTIBYTE == EUC_CN || MULTIBYTE == EUC_KR || MULTIBYTE == EUC_TW -# define NONCHAR(c) ((c) > USHRT_MAX) -# define NNONCHAR (CODEMAX-USHRT_MAX) -# elif MULTIBYTE == UNICODE -# define NONCHAR(c) ((c) > USHRT_MAX) -# define NNONCHAR (CODEMAX-USHRT_MAX) -# else /* assume 1 byte code such as ISO8859-1 */ -# define NONCHAR(c) ((c) > UCHAR_MAX) -# define NNONCHAR (CODEMAX-UCHAR_MAX) -# endif +# define NONCHAR(c) ((c) > 16777216) /* 16777216 == 2^24 == 3 bytes */ +# define NNONCHAR (CODEMAX-16777216) #else # define NONCHAR(c) ((c) > CHAR_MAX) # define NNONCHAR (CODEMAX-CHAR_MAX) diff --git a/src/backend/rewrite/Makefile b/src/backend/rewrite/Makefile index 557313e3dd4505ce473020f47661079b89103287..786af7502ee573bec2ddefa9bfbeb1dd76b03474 100644 --- a/src/backend/rewrite/Makefile +++ b/src/backend/rewrite/Makefile @@ -4,7 +4,7 @@ # Makefile for rewrite # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/rewrite/Makefile,v 1.7 1998/07/24 03:31:30 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/rewrite/Makefile,v 1.8 1998/07/26 04:30:37 scrappy Exp $ # #------------------------------------------------------------------------- @@ -12,8 +12,8 @@ SRCDIR = ../.. include ../../Makefile.global CFLAGS += -I.. -ifdef MB -CFLAGS += -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = rewriteRemove.o rewriteDefine.o \ diff --git a/src/backend/rewrite/rewriteSupport.c b/src/backend/rewrite/rewriteSupport.c index 9acf1eb13b18eaf2f749f6ad6408d891a103eb5f..dd9dffd58f4419ba3f86f22ef7aec2ed221b3b00 100644 --- a/src/backend/rewrite/rewriteSupport.c +++ b/src/backend/rewrite/rewriteSupport.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.22 1998/07/24 03:31:31 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.23 1998/07/26 04:30:38 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,7 @@ #include "access/heapam.h" #include "catalog/catname.h" #include "catalog/indexing.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_class_mb.h" #else #include "catalog/pg_class.h" diff --git a/src/backend/storage/lmgr/Makefile b/src/backend/storage/lmgr/Makefile index 5c7ee26afaf89fc0948519141475fe552afa7f2e..66fc25484a48231196a7e3fb9187671f6938719f 100644 --- a/src/backend/storage/lmgr/Makefile +++ b/src/backend/storage/lmgr/Makefile @@ -4,7 +4,7 @@ # Makefile for storage/lmgr # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Makefile,v 1.7 1998/07/24 03:31:32 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Makefile,v 1.8 1998/07/26 04:30:40 scrappy Exp $ # #------------------------------------------------------------------------- @@ -12,8 +12,8 @@ SRCDIR = ../../.. include ../../../Makefile.global CFLAGS += -I../.. -ifdef MB -CFLAGS += -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = lmgr.o lock.o multi.o proc.o single.o diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c index a2633744e98e5cb5134e971dd91441cde633a39a..5cea3b2e1f3177d723efa8bec83fd627fcab3f70 100644 --- a/src/backend/storage/lmgr/lmgr.c +++ b/src/backend/storage/lmgr/lmgr.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.14 1998/07/24 03:31:33 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.15 1998/07/26 04:30:41 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -41,7 +41,7 @@ #include "catalog/catname.h" #include "catalog/catalog.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_class_mb.h" #else #include "catalog/pg_class.h" diff --git a/src/backend/storage/smgr/Makefile b/src/backend/storage/smgr/Makefile index 95784123fb44a9a5b44afafc1d6ac85b652d7009..78da3053efd3230c98be550286af7be4852442b2 100644 --- a/src/backend/storage/smgr/Makefile +++ b/src/backend/storage/smgr/Makefile @@ -4,7 +4,7 @@ # Makefile for storage/smgr # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/storage/smgr/Makefile,v 1.7 1998/07/24 03:31:35 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/storage/smgr/Makefile,v 1.8 1998/07/26 04:30:43 scrappy Exp $ # #------------------------------------------------------------------------- @@ -13,8 +13,8 @@ include ../../../Makefile.global CFLAGS += -I../.. -ifdef MB -CFLAGS += -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = md.o mm.o smgr.o smgrtype.o diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 850b8df96ad4e99b6c7fca79739ed0fdf9def3d7..91b45033cf8b763dfa7e7209333c2d784781ba09 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.34 1998/07/24 03:31:35 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.35 1998/07/26 04:30:44 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -568,11 +568,11 @@ mdblindwrt(char *dbstr, Oid owner, id; char *tmpPath; -#ifdef MB +#ifdef MULTIBYTE int tmpEncoding; #endif -#ifdef MB +#ifdef MULTIBYTE GetRawDatabaseInfo(dbstr, &owner, &id, dbpath, &tmpEncoding); #else GetRawDatabaseInfo(dbstr, &owner, &id, dbpath); @@ -614,11 +614,11 @@ mdblindwrt(char *dbstr, id; char *tmpPath; -#ifdef MB +#ifdef MULTIBYTE int tmpEncoding; #endif -#ifdef MB +#ifdef MULTIBYTE GetRawDatabaseInfo(dbstr, &owner, &id, dbpath, &tmpEncoding); #else GetRawDatabaseInfo(dbstr, &owner, &id, dbpath); diff --git a/src/backend/tcop/Makefile b/src/backend/tcop/Makefile index e8e88d84392bc72b1b493265417fe6684786f124..44b755242accbc6971d6037f0c67204e1ce582ce 100644 --- a/src/backend/tcop/Makefile +++ b/src/backend/tcop/Makefile @@ -4,7 +4,7 @@ # Makefile for tcop # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/tcop/Makefile,v 1.17 1998/06/16 07:29:30 momjian Exp $ +# $Header: /cvsroot/pgsql/src/backend/tcop/Makefile,v 1.18 1998/07/26 04:30:46 scrappy Exp $ # #------------------------------------------------------------------------- @@ -13,8 +13,8 @@ include ../../Makefile.global CFLAGS+= -I.. -ifdef MB -CFLAGS+= -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif ifeq ($(CC), gcc) diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index bcf4259c2a2c6b8e2b8652d5fde5b467dfe373a5..8e66175e4af078b02264a305c1a63c3d35c55df9 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.80 1998/07/18 18:34:09 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.81 1998/07/26 04:30:46 scrappy Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -84,7 +84,7 @@ #endif #ifdef MULTIBYTE -#include "commands/variable.h" +#include "mb/pg_wchar.h" #endif /* ---------------- @@ -1339,7 +1339,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) if (!IsUnderPostmaster) { puts("\nPOSTGRES backend interactive interface"); - puts("$Revision: 1.80 $ $Date: 1998/07/18 18:34:09 $"); + puts("$Revision: 1.81 $ $Date: 1998/07/26 04:30:46 $"); } /* ---------------- diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 01520324a7440f9d4a2fd35c103fca93f3123abc..94f44a73857076f37e053e089bb0a073693a4b39 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.43 1998/07/24 03:31:38 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.44 1998/07/26 04:30:48 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -558,7 +558,7 @@ ProcessUtility(Node *parsetree, *ps_status = commandTag = "CREATEDB"; CHECK_IF_ABORTED(); -#ifdef MB +#ifdef MULTIBYTE createdb(stmt->dbname, stmt->dbpath, stmt->encoding); #else createdb(stmt->dbname, stmt->dbpath); diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile index 2f09fe46fe0b0d526c92c4228df095224b1d68dd..b28d37f9d55b2934f2d40074f9102e2d19b47216 100644 --- a/src/backend/utils/Makefile +++ b/src/backend/utils/Makefile @@ -4,7 +4,7 @@ # Makefile for utils # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/utils/Makefile,v 1.7 1998/07/24 03:31:39 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/utils/Makefile,v 1.8 1998/07/26 04:30:50 scrappy Exp $ # #------------------------------------------------------------------------- @@ -23,7 +23,7 @@ OBJS = fmgrtab.o adt/SUBSYS.o cache/SUBSYS.o error/SUBSYS.o \ DIRS = adt cache error fmgr hash init misc mmgr sort time -ifdef MB +ifdef MULTIBYTE OBJS += mb/SUBSYS.o DIRS += mb endif diff --git a/src/backend/utils/adt/Makefile b/src/backend/utils/adt/Makefile index 358e9f501df5523441a0c91b991898f6b98b332a..f8bfa0ff0dde7249d9e413be4728e3876a1d2aa2 100644 --- a/src/backend/utils/adt/Makefile +++ b/src/backend/utils/adt/Makefile @@ -4,7 +4,7 @@ # Makefile for utils/adt # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.14 1998/07/08 13:57:05 thomas Exp $ +# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.15 1998/07/26 04:30:52 scrappy Exp $ # #------------------------------------------------------------------------- @@ -13,8 +13,8 @@ include ../../../Makefile.global CFLAGS += -I../.. -ifdef MB -CFLAGS+=-DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = acl.o arrayfuncs.o arrayutils.o bool.o cash.o char.o chunk.o \ diff --git a/src/backend/utils/cache/Makefile b/src/backend/utils/cache/Makefile index 78eed2b19b9b6a6f9602d140c8dbbbf357bd6227..ada76622cd9f152097e11e857c861b15bd7ab407 100644 --- a/src/backend/utils/cache/Makefile +++ b/src/backend/utils/cache/Makefile @@ -4,7 +4,7 @@ # Makefile for utils/cache # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/utils/cache/Makefile,v 1.7 1998/07/24 03:31:46 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/utils/cache/Makefile,v 1.8 1998/07/26 04:30:54 scrappy Exp $ # #------------------------------------------------------------------------- @@ -12,8 +12,8 @@ SRCDIR = ../../.. include ../../../Makefile.global CFLAGS += -I../.. -ifdef MB -CFLAGS += -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = catcache.o inval.o rel.o relcache.o syscache.o lsyscache.o fcache.o diff --git a/src/backend/utils/cache/fcache.c b/src/backend/utils/cache/fcache.c index 28af48dc90420c39d604697744222eb5def64b53..1a10eaedb4b162e9d89fe85905a4e8b7a410369d 100644 --- a/src/backend/utils/cache/fcache.c +++ b/src/backend/utils/cache/fcache.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.13 1998/07/24 03:31:46 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.14 1998/07/26 04:30:55 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -22,7 +22,7 @@ #include "catalog/pg_type.h" #include "catalog/pg_proc.h" #include "catalog/pg_language.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_class_mb.h" #else #include "catalog/pg_class.h" diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 1f97949d3039888ac9301f4787d96ec9036e0dde..704941b51d24fc167b5e93572664faf2f47e84e4 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.42 1998/07/24 03:31:47 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.43 1998/07/26 04:30:57 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ #include "catalog/indexing.h" #include "catalog/pg_aggregate.h" #include "catalog/pg_attrdef.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_attribute_mb.h" #else #include "catalog/pg_attribute.h" diff --git a/src/backend/utils/init/Makefile b/src/backend/utils/init/Makefile index c9d7826dce36f84e899779094749d5e7477c1be9..0b306fcf69c3c37dd492942d7ad5a07704aaa9b0 100644 --- a/src/backend/utils/init/Makefile +++ b/src/backend/utils/init/Makefile @@ -4,7 +4,7 @@ # Makefile for utils/init # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.8 1998/07/24 03:31:49 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.9 1998/07/26 04:31:00 scrappy Exp $ # #------------------------------------------------------------------------- @@ -12,8 +12,8 @@ SRCDIR = ../../.. include ../../../Makefile.global CFLAGS += -I../.. -ifdef MB -CFLAGS += -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = enbl.o findbe.o globals.o miscinit.o postinit.o diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index a5d727b43843ceb9e40e8145ecdde80ef085b5ef..c7dd1727ae2f13d16b531077512aa8b78ac6df32 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.17 1998/07/24 03:31:50 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.18 1998/07/26 04:31:01 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -234,8 +234,8 @@ SetDatabaseName(char *name) strcpy(DatabaseName, name); } -#ifndef MB -/* even if MB is not enabled, this function is neccesary +#ifndef MULTIBYTE +/* even if MULTIBYTE is not enabled, this function is neccesary * since pg_proc.h does have. */ const char * diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 57ce319e764ed1f72dddc9ea640806de9e92d9ba..465b41509e483e3294f813e48019921414b16b52 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.31 1998/07/24 03:31:50 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.32 1998/07/26 04:31:01 scrappy Exp $ * * NOTES * InitPostgres() is the function called from PostgresMain @@ -66,7 +66,7 @@ #include "utils/inval.h" #include "catalog/catname.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_database_mb.h" #include "mb/pg_wchar.h" #else @@ -83,7 +83,7 @@ static void InitStdio(void); static void InitUserid(void); extern char *ExpandDatabasePath(char *name); -#ifdef MB +#ifdef MULTIBYTE extern void GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path, int *encoding); #else extern void GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path); @@ -128,12 +128,12 @@ InitMyDatabaseInfo(char *name) Oid owner; char *path, myPath[MAXPGPATH + 1]; -#ifdef MB +#ifdef MULTIBYTE int encoding; #endif SetDatabaseName(name); -#ifdef MB +#ifdef MULTIBYTE GetRawDatabaseInfo(name, &owner, &MyDatabaseId, myPath, &encoding); #else GetRawDatabaseInfo(name, &owner, &MyDatabaseId, myPath); @@ -147,7 +147,7 @@ InitMyDatabaseInfo(char *name) path = ExpandDatabasePath(myPath); SetDatabasePath(path); -#ifdef MB +#ifdef MULTIBYTE SetDatabaseEncoding(encoding); #endif diff --git a/src/backend/utils/mb/Makefile b/src/backend/utils/mb/Makefile index 9f501eb510e617f9efab3ab8d7478107723167a3..5b7cb745add50a22bd6bceda8d67847a3dcd467e 100644 --- a/src/backend/utils/mb/Makefile +++ b/src/backend/utils/mb/Makefile @@ -4,7 +4,7 @@ # Makefile for utils/mb # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/utils/mb/Makefile,v 1.1 1998/07/24 03:31:54 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/utils/mb/Makefile,v 1.2 1998/07/26 04:31:03 scrappy Exp $ # #------------------------------------------------------------------------- @@ -12,8 +12,8 @@ SRCDIR = ../../.. include ../../../Makefile.global CFLAGS += -I../.. -ifdef MB -CFLAGS += -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = common.o conv.o mbutils.o wchar.o wstrcmp.o wstrncmp.o variable.o diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c index eb6cbc5262d1c8a28800ed9fd94f6afcd6d864d7..3a473704dc906ca09580499f7979f2ed8666bd8a 100644 --- a/src/backend/utils/mb/mbutils.c +++ b/src/backend/utils/mb/mbutils.c @@ -3,7 +3,7 @@ * client encoding and server internal encoding. * (currently mule internal code (mic) is used) * Tatsuo Ishii - * $Id: mbutils.c,v 1.1 1998/07/24 03:31:56 scrappy Exp $ */ + * $Id: mbutils.c,v 1.2 1998/07/26 04:31:04 scrappy Exp $ */ #include <stdio.h> #include <string.h> @@ -183,7 +183,7 @@ int pg_mbstrlen_with_len(const unsigned char *mbstr, int limit) /* * fuctions for utils/init */ -static int DatabaseEncoding = MB; +static int DatabaseEncoding = MULTIBYTE; void SetDatabaseEncoding(int encoding) { diff --git a/src/backend/utils/misc/Makefile b/src/backend/utils/misc/Makefile index b6993d1108a72e32bfbd93dc43aa27026a200c94..737ff7036fadb9d29ae1f05fc223bcf78f6b793a 100644 --- a/src/backend/utils/misc/Makefile +++ b/src/backend/utils/misc/Makefile @@ -4,7 +4,7 @@ # Makefile for utils/misc # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/utils/misc/Makefile,v 1.7 1998/07/24 03:31:58 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/backend/utils/misc/Makefile,v 1.8 1998/07/26 04:31:06 scrappy Exp $ # #------------------------------------------------------------------------- @@ -13,8 +13,8 @@ include ../../../Makefile.global CFLAGS += -I../.. -ifdef MB -CFLAGS += -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS = database.o superuser.o diff --git a/src/backend/utils/misc/database.c b/src/backend/utils/misc/database.c index 6a106b9ad1213723de7f22bb70ed0a047097d255..69d67e5e1a471a90e247f84cb88387179c77205c 100644 --- a/src/backend/utils/misc/database.c +++ b/src/backend/utils/misc/database.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.12 1998/07/24 03:31:59 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.13 1998/07/26 04:31:07 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -22,7 +22,7 @@ #include "access/heapam.h" #include "access/xact.h" #include "catalog/catname.h" -#ifdef MB +#ifdef MULTIBYTE #include "catalog/pg_database_mb.h" #include "mb/pg_wchar.h" #else @@ -184,7 +184,7 @@ ExpandDatabasePath(char *dbpath) * -------------------------------- */ void -#ifdef MB +#ifdef MULTIBYTE GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path, int *encoding) #else GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path) @@ -275,14 +275,23 @@ GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path) * means of getting at sys cat attrs. */ tup_db = (Form_pg_database) GETSTRUCT(tup); - +#ifdef MULTIBYTE + /* get encoding from template database. + This is the "default for default" for + create database command. + */ + if (strcmp("template1",tup_db->datname.data) == 0) + { + SetTemplateEncoding(tup_db->encoding); + } +#endif if (strcmp(name, tup_db->datname.data) == 0) { *db_id = tup->t_oid; strncpy(path, VARDATA(&(tup_db->datpath)), (VARSIZE(&(tup_db->datpath)) - VARHDRSZ)); *(path + VARSIZE(&(tup_db->datpath)) - VARHDRSZ) = '\0'; -#ifdef MB +#ifdef MULTIBYTE *encoding = tup_db->encoding; #endif goto done; diff --git a/src/bin/Makefile b/src/bin/Makefile index ceb610359a52662c013b4251bb37677642d34e80..56cec86817a3cfc43f274339761c5a1d8a5daa9d 100644 --- a/src/bin/Makefile +++ b/src/bin/Makefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.14 1998/07/24 03:32:02 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.15 1998/07/26 04:31:08 scrappy Exp $ # #------------------------------------------------------------------------- @@ -17,7 +17,7 @@ include ../Makefile.global DIRS = pg_id pg_version psql pg_dump pg_passwd cleardbdir createdb \ createuser destroydb destroyuser initdb initlocation ipcclean -ifdef MB +ifdef MULTIBYTE DIRS += pg_encoding endif diff --git a/src/bin/createdb/Makefile b/src/bin/createdb/Makefile index 896fe33d92d29f49dd4e9a5a9b24cef98609c304..2dc29b6e6563bda69e4baac992e10d39e122e917 100644 --- a/src/bin/createdb/Makefile +++ b/src/bin/createdb/Makefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/Makefile,v 1.9 1998/07/24 03:32:04 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/Makefile,v 1.10 1998/07/26 04:31:12 scrappy Exp $ # #------------------------------------------------------------------------- @@ -17,7 +17,7 @@ include ../../Makefile.global all: createdb createdb: createdb.sh - sed 's/__MB__/$(MB)/' createdb.sh > createdb + sed 's/__MULTIBYTE__/$(MULTIBYTE)/' createdb.sh > createdb install: createdb $(INSTALL) $(INSTL_EXE_OPTS) $< $(BINDIR)/$< diff --git a/src/bin/createdb/createdb.sh b/src/bin/createdb/createdb.sh index 2217f19714a32708ab3bc941626f2ec5b4d5c8ac..0eefe639046f9bb4cd4c75ab5eaf3eeaa139358c 100644 --- a/src/bin/createdb/createdb.sh +++ b/src/bin/createdb/createdb.sh @@ -11,13 +11,13 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.9 1998/07/24 03:32:06 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.10 1998/07/26 04:31:13 scrappy Exp $ # #------------------------------------------------------------------------- CMDNAME=`basename $0` -MBENABLED=__MB__ +MBENABLED=__MULTIBYTE__ MB= if [ -z "$USER" ]; then diff --git a/src/bin/initdb/Makefile b/src/bin/initdb/Makefile index e46e3af841e925cfb96bb56e1054224f3306b353..9931e07f17fe47ee6fc819d964447696ad3daa9e 100644 --- a/src/bin/initdb/Makefile +++ b/src/bin/initdb/Makefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.10 1998/07/24 03:32:08 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.11 1998/07/26 04:31:16 scrappy Exp $ # #------------------------------------------------------------------------- @@ -17,7 +17,7 @@ include ../../Makefile.global all: initdb initdb: initdb.sh - sed 's/__MB__/$(MB)/' initdb.sh > initdb + sed 's/__MULTIBYTE__/$(MULTIBYTE)/' initdb.sh > initdb install: initdb $(INSTALL) $(INSTL_EXE_OPTS) $< $(BINDIR)/$< diff --git a/src/bin/initdb/initdb.sh b/src/bin/initdb/initdb.sh index 4e7a2ce2b4a6565e70ecb5d6f5fee5e95cb3931d..16c82aad45667d0e44ae92f76d64c2e96ce9e323 100644 --- a/src/bin/initdb/initdb.sh +++ b/src/bin/initdb/initdb.sh @@ -26,7 +26,445 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.43 1998/07/26 04:22:42 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.44 1998/07/26 04:31:16 scrappy Exp $ +# +#------------------------------------------------------------------------- + +# ---------------- +# The _fUnKy_..._sTuFf_ gets set when the script is built (with make) +# from parameters set in the make file. +# +# ---------------- + +CMDNAME=`basename $0` + +MULTIBYTE=__MULTIBYTE__ +if [ -n "$MULTIBYTE" ];then + MULTIBYTEID=`pg_encoding $MULTIBYTE` +fi + +# Find the default PGLIB directory (the directory that contains miscellaneous +# files that are part of Postgres). The user-written program postconfig +# outputs variable settings like "PGLIB=/usr/lib/whatever". If it doesn't +# output a PGLIB value, then there is no default and the user must +# specify the pglib option. Postconfig may validly not exist, in which case +# our invocation of it silently fails. + +# The 2>/dev/null is to swallow the "postconfig: not found" message if there +# is no postconfig. + +postconfig_result="`sh -c postconfig 2>/dev/null`" +if [ ! -z "$postconfig_result" ]; then + set -a # Make the following variable assignment exported to environment + eval "$postconfig_result" + set +a # back to normal +fi + +# Set defaults: +debug=0 +noclean=0 +template_only=0 +POSTGRES_SUPERUSERNAME=$USER + +while [ "$#" -gt 0 ] +do +# ${ARG#--username=} is not reliable or available on all platforms + + case "$1" in + --debug|-d) + debug=1 + echo "Running with debug mode on." + ;; + --noclean|-n) + noclean=1 + echo "Running with noclean mode on. " + "Mistakes will not be cleaned up." + ;; + --template|-t) + template_only=1 + echo "updating template1 database only." + ;; + --username=*) + POSTGRES_SUPERUSERNAME="`echo $1 | sed 's/^--username=//'`" + ;; + -u) + shift + POSTGRES_SUPERUSERNAME="$1" + ;; + -u*) + POSTGRES_SUPERUSERNAME="`echo $1 | sed 's/^-u//'`" + ;; + --pgdata=*) + PGDATA="`echo $1 | sed 's/^--pgdata=//'`" + ;; + -r) + shift + PGDATA="$1" + ;; + -r*) + PGDATA="`echo $1 | sed 's/^-r//'`" + ;; + --pglib=*) + PGLIB="`echo $1 | sed 's/^--pglib=//'`" + ;; + -l) + shift + PGLIB="$1" + ;; + -l*) + PGLIB="`echo $1 | sed 's/^-l//'`" + ;; + + --pgencoding=*) + if [ -z "$MULTIBYTE" ];then + echo "MULTIBYTE support seems to be disabled" + exit 100 + fi + mb="`echo $1 | sed 's/^--pgencoding=//'`" + MULTIBYTEID=`pg_encoding $mb` + if [ -z "$MULTIBYTEID" ];then + echo "$mb is not a valid encoding name" + exit 100 + fi + ;; + -e) + if [ -z "$MULTIBYTE" ];then + echo "MULTIBYTE support seems to be disabled" + exit 100 + fi + shift + MULTIBYTEID=`pg_encoding $1` + if [ -z "$MULTIBYTEID" ];then + echo "$1 is not a valid encoding name" + exit 100 + fi + ;; + -e*) + if [ -z "$MULTIBYTE" ];then + echo "MULTIBYTE support seems to be disabled" + exit 100 + fi + mb="`echo $1 | sed 's/^-e//'`" + MULTIBYTEID=`pg_encoding $mb` + if [ -z "$MULTIBYTEID" ];then + echo "$mb is not a valid encoding name" + exit 100 + fi + ;; + *) + echo "Unrecognized option '$1'. Syntax is:" + if [ -z "$MULTIBYTE" ];then + echo "initdb [-t | --template] [-d | --debug]" \ + "[-n | --noclean]" \ + "[-u SUPERUSER | --username=SUPERUSER]" \ + "[-r DATADIR | --pgdata=DATADIR]" \ + "[-l LIBDIR | --pglib=LIBDIR]" + else + echo "initdb [-t | --template] [-d | --debug]" \ + "[-n | --noclean]" \ + "[-u SUPERUSER | --username=SUPERUSER]" \ + "[-r DATADIR | --pgdata=DATADIR]" \ + "[-l LIBDIR | --pglib=LIBDIR]" \ + "[-e ENCODING | --pgencoding=ENCODING]" + fi + exit 100 + esac + shift +done + +#------------------------------------------------------------------------- +# Make sure he told us where to find the Postgres files. +#------------------------------------------------------------------------- +if [ -z "$PGLIB" ]; then + echo "$CMDNAME does not know where to find the files that make up " + echo "Postgres (the PGLIB directory). You must identify the PGLIB " + echo "directory either with a --pglib invocation option, or by " + echo "setting the PGLIB environment variable, or by having a program " + echo "called 'postconfig' in your search path that outputs an asignment " + echo "for PGLIB." + exit 20 +fi + +#------------------------------------------------------------------------- +# Make sure he told us where to build the database system +#------------------------------------------------------------------------- + +if [ -z "$PGDATA" ]; then + echo "$CMDNAME: You must identify the PGDATA directory, where the data" + echo "for this database system will reside. Do this with either a" + echo "--pgdata invocation option or a PGDATA environment variable." + echo + exit 20 +fi + +TEMPLATE=$PGLIB/local1_template1.bki.source +GLOBAL=$PGLIB/global1.bki.source +TEMPLATE_DESCR=$PGLIB/local1_template1.description +GLOBAL_DESCR=$PGLIB/global1.description +PG_HBA_SAMPLE=$PGLIB/pg_hba.conf.sample +PG_GEQO_SAMPLE=$PGLIB/pg_geqo.sample + + +#------------------------------------------------------------------------- +# Find the input files +#------------------------------------------------------------------------- + +for PREREQ_FILE in $TEMPLATE $GLOBAL $PG_HBA_SAMPLE; do + if [ ! -f $PREREQ_FILE ]; then + echo "$CMDNAME does not find the file '$PREREQ_FILE'." + echo "This means you have identified an invalid PGLIB directory." + echo "You specify a PGLIB directory with a --pglib invocation " + echo "option, a PGLIB environment variable, or a postconfig program." + exit 1 + fi +done + +echo "$CMDNAME: using $TEMPLATE as input to create the template database." +if [ $template_only -eq 0 ]; then + echo "$CMDNAME: using $GLOBAL as input to create the global classes." + echo "$CMDNAME: using $PG_HBA_SAMPLE as the host-based authentication" \ + "control file." + echo +fi + +#--------------------------------------------------------------------------- +# Figure out who the Postgres superuser for the new database system will be. +#--------------------------------------------------------------------------- + +if [ -z "$POSTGRES_SUPERUSERNAME" ]; then + echo "Can't tell what username to use. You don't have the USER" + echo "environment variable set to your username and didn't specify the " + echo "--username option" + exit 1 +fi + +POSTGRES_SUPERUID=`pg_id $POSTGRES_SUPERUSERNAME` + +if [ $POSTGRES_SUPERUID = NOUSER ]; then + echo "Valid username not given. You must specify the username for " + echo "the Postgres superuser for the database system you are " + echo "initializing, either with the --username option or by default " + echo "to the USER environment variable." + exit 10 +fi + +if [ $POSTGRES_SUPERUID -ne `pg_id` -a `pg_id` -ne 0 ]; then + echo "Only the unix superuser may initialize a database with a different" + echo "Postgres superuser. (You must be able to create files that belong" + echo "to the specified unix user)." + exit 2 +fi + +echo "We are initializing the database system with username" \ + "$POSTGRES_SUPERUSERNAME (uid=$POSTGRES_SUPERUID)." +echo "This user will own all the files and must also own the server process." +echo + +# ----------------------------------------------------------------------- +# Create the data directory if necessary +# ----------------------------------------------------------------------- + +# umask must disallow access to group, other for files and dirs +umask 077 + +if [ -f "$PGDATA/PG_VERSION" ]; then + if [ $template_only -eq 0 ]; then + echo "$CMDNAME: error: File $PGDATA/PG_VERSION already exists." + echo "This probably means initdb has already been run and the " + echo "database system already exists." + echo + echo "If you want to create a new database system, either remove " + echo "the $PGDATA directory or run initdb with a --pgdata option " + echo "other than $PGDATA." + exit 1 + fi +else + if [ ! -d $PGDATA ]; then + echo "Creating Postgres database system directory $PGDATA" + echo + mkdir $PGDATA + if [ $? -ne 0 ]; then exit 5; fi + fi + if [ ! -d $PGDATA/base ]; then + echo "Creating Postgres database system directory $PGDATA/base" + echo + mkdir $PGDATA/base + if [ $? -ne 0 ]; then exit 5; fi + fi +fi + +#---------------------------------------------------------------------------- +# Create the template1 database +#---------------------------------------------------------------------------- + +rm -rf $PGDATA/base/template1 +mkdir $PGDATA/base/template1 + +if [ "$debug" -eq 1 ]; then + BACKEND_TALK_ARG="-d" +else + BACKEND_TALK_ARG="-Q" +fi + +BACKENDARGS="-boot -C -F -D$PGDATA $BACKEND_TALK_ARG" + +echo "$CMDNAME: creating template database in $PGDATA/base/template1" +echo "Running: postgres $BACKENDARGS template1" + +cat $TEMPLATE \ +| sed -e "s/postgres PGUID/$POSTGRES_SUPERUSERNAME $POSTGRES_SUPERUID/" \ + -e "s/PGUID/$POSTGRES_SUPERUID/" \ +| postgres $BACKENDARGS template1 + +if [ $? -ne 0 ]; then + echo "$CMDNAME: could not create template database" + if [ $noclean -eq 0 ]; then + echo "$CMDNAME: cleaning up by wiping out $PGDATA/base/template1" + rm -rf $PGDATA/base/template1 + else + echo "$CMDNAME: cleanup not done because noclean options was used." + fi + exit 1; +fi + +echo + +pg_version $PGDATA/base/template1 + +#---------------------------------------------------------------------------- +# Create the global classes, if requested. +#---------------------------------------------------------------------------- + +if [ $template_only -eq 0 ]; then + echo "Creating global classes in $PG_DATA/base" + echo "Running: postgres $BACKENDARGS template1" + + cat $GLOBAL \ + | sed -e "s/postgres PGUID/$POSTGRES_SUPERUSERNAME $POSTGRES_SUPERUID/" \ + -e "s/PGUID/$POSTGRES_SUPERUID/" \ + | postgres $BACKENDARGS template1 + + if (test $? -ne 0) + then + echo "$CMDNAME: could not create global classes." + if (test $noclean -eq 0); then + echo "$CMDNAME: cleaning up." + rm -rf $PGDATA + else + echo "$CMDNAME: cleanup not done (noclean mode set)." + fi + exit 1; + fi + + echo + + pg_version $PGDATA + + cp $PG_HBA_SAMPLE $PGDATA/pg_hba.conf + cp $PG_GEQO_SAMPLE $PGDATA/pg_geqo.sample + + echo "Adding template1 database to pg_database..." + + echo "open pg_database" > /tmp/create.$$ + if [ -z "$MULTIBYTE" ];then + echo "insert (template1 $POSTGRES_SUPERUID template1)" >> /tmp/create.$$ + else + echo "insert (template1 $POSTGRES_SUPERUID $MULTIBYTEID template1)" >> /tmp/create.$$ + fi + #echo "show" >> /tmp/create.$$ + echo "close pg_database" >> /tmp/create.$$ + + echo "Running: postgres $BACKENDARGS template1 < /tmp/create.$$" + + postgres $BACKENDARGS template1 < /tmp/create.$$ + + if [ $? -ne 0 ]; then + echo "$CMDNAME: could not log template database" + if [ $noclean -eq 0 ]; then + echo "$CMDNAME: cleaning up." + rm -rf $PGDATA + else + echo "$CMDNAME: cleanup not done (noclean mode set)." + fi + exit 1; + fi + rm -f /tmp/create.$$ +fi + +echo + +PGSQL_OPT="-o /dev/null -F -Q -D$PGDATA" + +# If the COPY is first, the VACUUM generates an error, so we vacuum first +echo "vacuuming template1" +echo "vacuum" | postgres $PGSQL_OPT template1 > /dev/null + +echo "COPY pg_shadow TO '$PGDATA/pg_pwd' USING DELIMITERS '\\t'" | \ + postgres $PGSQL_OPT template1 > /dev/null + +echo "creating public pg_user view" +echo "CREATE TABLE xpg_user ( \ + usename name, \ + usesysid int4, \ + usecreatedb bool, \ + usetrace bool, \ + usesuper bool, \ + usecatupd bool, \ + passwd text, \ + valuntil abstime);" | postgres $PGSQL_OPT template1 > /dev/null + +#move it into pg_user +echo "UPDATE pg_class SET relname = 'pg_user' WHERE relname = 'xpg_user';" |\ + postgres $PGSQL_OPT template1 > /dev/null +echo "UPDATE pg_type SET typname = 'pg_user' WHERE typname = 'xpg_user';" |\ + postgres $PGSQL_OPT template1 > /dev/null +mv $PGDATA/base/template1/xpg_user $PGDATA/base/template1/pg_user + +echo "CREATE RULE _RETpg_user AS ON SELECT TO pg_user DO INSTEAD \ + SELECT usename, usesysid, usecreatedb, usetrace, \ + usesuper, usecatupd, '********'::text as passwd, \ + valuntil FROM pg_shadow;" | \ + postgres $PGSQL_OPT template1 > /dev/null +echo "REVOKE ALL on pg_shadow FROM public" | \ + postgres $PGSQL_OPT template1 > /dev/null + +echo "loading pg_description" +echo "copy pg_description from '$TEMPLATE_DESCR'" | \ + postgres $PGSQL_OPT template1 > /dev/null +echo "copy pg_description from '$GLOBAL_DESCR'" | \ + postgres $PGSQL_OPT template1 > /dev/null +echo "vacuum analyze" | \ + postgres $PGSQL_OPT template1 > /dev/null + +#!/bin/sh +#------------------------------------------------------------------------- +# +# initdb.sh-- +# Create (initialize) a Postgres database system. +# +# A database system is a collection of Postgres databases all managed +# by the same postmaster. +# +# To create the database system, we create the directory that contains +# all its data, create the files that hold the global classes, create +# a few other control files for it, and create one database: the +# template database. +# +# The template database is an ordinary Postgres database. Its data +# never changes, though. It exists to make it easy for Postgres to +# create other databases -- it just copies. +# +# Optionally, we can skip creating the database system and just create +# (or replace) the template database. +# +# To create all those classes, we run the postgres (backend) program and +# feed it data from bki files that are in the Postgres library directory. +# +# Copyright (c) 1994, Regents of the University of California +# +# +# IDENTIFICATION +# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.44 1998/07/26 04:31:16 scrappy Exp $ # #------------------------------------------------------------------------- diff --git a/src/bin/pg_encoding/Makefile b/src/bin/pg_encoding/Makefile index 4830f0d0539c1821fda263389d69ab28e00e6f13..587abbd089d5fa836c66b1aad21bdd98ab555ced 100644 --- a/src/bin/pg_encoding/Makefile +++ b/src/bin/pg_encoding/Makefile @@ -6,7 +6,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/Makefile,v 1.1 1998/07/24 03:32:10 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/Makefile,v 1.2 1998/07/26 04:31:18 scrappy Exp $ # #------------------------------------------------------------------------- @@ -15,7 +15,7 @@ include ../../Makefile.global OBJS= pg_encoding.o -CFLAGS+= -DMB=$(MB) -I$(SRCDIR)/include +CFLAGS+= $(MBFLAGS) -I$(SRCDIR)/include all: pg_encoding diff --git a/src/bin/psql/Makefile.in b/src/bin/psql/Makefile.in index d34abdef46c49b7a24a73f9b8d844e11692bac78..66a9748669f39a7331cab12dc54c42193fd88812 100644 --- a/src/bin/psql/Makefile.in +++ b/src/bin/psql/Makefile.in @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/psql/Attic/Makefile.in,v 1.12 1998/06/16 07:29:37 momjian Exp $ +# $Header: /cvsroot/pgsql/src/bin/psql/Attic/Makefile.in,v 1.13 1998/07/26 04:31:20 scrappy Exp $ # #------------------------------------------------------------------------- @@ -24,8 +24,8 @@ LDFLAGS+= $(KRBLIBS) CFLAGS+= $(KRBFLAGS) endif -ifdef MB -CFLAGS+= -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS= psql.o stringutils.o @STRDUP@ diff --git a/src/configure.in b/src/configure.in index 04361a259e8e696970199651a334d5d5fddb7482..ad1f34d8f283d2973a1725ac652eeee76bd5defc 100644 --- a/src/configure.in +++ b/src/configure.in @@ -190,20 +190,20 @@ AC_ARG_ENABLE( AC_MSG_RESULT(disabled) ) -AC_MSG_CHECKING(setting MB) +AC_MSG_CHECKING(setting MULTIBYE) AC_ARG_WITH(mb, [ --with-mb=<encoding> enable multi-byte support ], [ case "$withval" in EUC_JP|EHC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5) - MB="$withval"; + MULTIBYTE="$withval"; AC_MSG_RESULT("enabled with $withval") ;; *) AC_MSG_ERROR([*** You must supply an argument to the --with-mb option one of EUC_JP,EHC_CN,EUC_KR,EUC_TW,UNICODE,MULE_INTERNAL,LATIN1-5]) ;; esac - MB="$withval" + MULTIBYTEB="$withval" ], AC_MSG_RESULT("disabled") ) @@ -325,7 +325,7 @@ AC_SUBST(DLSUFFIX) AC_SUBST(DL_LIB) AC_SUBST(USE_TCL) AC_SUBST(USE_PERL) -AC_SUBST(MB) +AC_SUBST(MULTIBYTE) dnl Check for C++ support (allow override if needed) HAVECXX='HAVE_Cplusplus=true' diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h index 8675afa5c71fb01d7e5754b8a6242c58399fbb61..2b0da3114df7467a07eda241c77d852c0d5329a5 100644 --- a/src/include/commands/dbcommands.h +++ b/src/include/commands/dbcommands.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: dbcommands.h,v 1.3 1998/07/24 03:32:19 scrappy Exp $ + * $Id: dbcommands.h,v 1.4 1998/07/26 04:31:23 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -19,7 +19,7 @@ */ #define SIGKILLDAEMON1 SIGTERM -#ifdef MB +#ifdef MULTIBYTE extern void createdb(char *dbname, char *dbpath, int encoding); #else extern void createdb(char *dbname, char *dbpath); diff --git a/src/include/commands/variable.h b/src/include/commands/variable.h index c727dc027bb6532f54635dab34f2df5c71804588..92f4bda34621119e907b093538d09fbcd403164a 100644 --- a/src/include/commands/variable.h +++ b/src/include/commands/variable.h @@ -2,7 +2,7 @@ * Headers for handling of 'SET var TO', 'SHOW var' and 'RESET var' * statements * - * $Id: variable.h,v 1.4 1998/07/18 18:34:21 momjian Exp $ + * $Id: variable.h,v 1.5 1998/07/26 04:31:24 scrappy Exp $ * */ #ifndef VARIABLE_H @@ -54,17 +54,5 @@ extern bool set_geqo(void); extern bool show_geqo(void); extern bool reset_geqo(void); extern bool parse_geqo(const char *); -#ifdef MULTIBYTE -extern bool show_client_encoding(void); -extern bool reset_client_encoding(void); -extern bool parse_client_encoding(const char *); -extern int pg_set_client_encoding(int); -extern int pg_get_client_encoding(void); -extern unsigned char *pg_client_to_server(unsigned char *, int); -extern unsigned char *pg_server_to_client(unsigned char *, int); -extern int pg_valid_client_encoding(const char *); -extern const char *pg_encoding_to_char(int); -extern int pg_char_to_encoding(const char *); -#endif #endif /* VARIABLE_H */ diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h index 8453f38558dea46be8c6815eecb1720c7f03f3b8..41bbd97731c4dbf277fab738dedab41d40ca36b3 100644 --- a/src/include/mb/pg_wchar.h +++ b/src/include/mb/pg_wchar.h @@ -1,4 +1,4 @@ -/* $Id: pg_wchar.h,v 1.1 1998/07/24 03:32:24 scrappy Exp $ */ +/* $Id: pg_wchar.h,v 1.2 1998/07/26 04:31:26 scrappy Exp $ */ #ifndef PG_WCHAR_H #define PG_WCHAR_H @@ -25,7 +25,7 @@ /* followings are for client encoding only */ #define SJIS 32 /* Shift JIS */ -#ifdef MB +#ifdef MULTIBYTE typedef unsigned int pg_wchar; #else #define pg_wchar char @@ -67,7 +67,7 @@ typedef unsigned int pg_wchar; #define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */ #define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */ -#ifdef MB +#ifdef MULTIBYTE typedef struct { int encoding; /* encoding symbol value */ char *name; /* encoding name */ @@ -117,6 +117,6 @@ extern void SetDatabaseEncoding(int); extern void SetTemplateEncoding(int); extern int GetTemplateEncoding(void); -#endif /* MB */ +#endif /* MULTIBYTE */ #endif /* PG_WCHAR_H */ diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 74c8bf71f19d5b34ef9cb28114572e41219cee0d..e1b4831f294cb1f6151aff6b4c0555960257f0f6 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -11,7 +11,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: miscadmin.h,v 1.28 1998/07/24 03:32:13 scrappy Exp $ + * $Id: miscadmin.h,v 1.29 1998/07/26 04:31:23 scrappy Exp $ * * NOTES * some of the information in this file will be moved to @@ -116,7 +116,7 @@ extern char *DatabaseName; extern char *DatabasePath; /* in utils/misc/database.c */ -#ifdef MB +#ifdef MULTIBYTE extern void GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path, int *encoding); #else extern void GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path); diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index c2c2c0fc7bba41922f1446aa2ad9bdd69acc84bc..bb6a657c0b4100c499f7c769f8ed0f9e900f137a 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: parsenodes.h,v 1.51 1998/07/24 03:32:26 scrappy Exp $ + * $Id: parsenodes.h,v 1.52 1998/07/26 04:31:29 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -480,7 +480,7 @@ typedef struct CreatedbStmt NodeTag type; char *dbname; /* database to create */ char *dbpath; /* location of database */ -#ifdef MB +#ifdef MULTIBYTE int encoding; /* default encoding (see regex/pg_wchar.h) */ #endif diff --git a/src/include/regex/regex2.h b/src/include/regex/regex2.h index 3bd1469750d2eaa4fa7371487072cbf7cc8c2773..e17491164a029951d45cddbae395c48867482b75 100644 --- a/src/include/regex/regex2.h +++ b/src/include/regex/regex2.h @@ -197,15 +197,7 @@ struct re_guts /* misc utilities */ #ifdef MULTIBYTE -# if MULTIBYTE == MULE_INTERNAL -# define OUT (16777216+1) /* 16777216 == 2^24 == 3 bytes */ -# elif MULTIBYTE == EUC_JP || MULTIBYTE == EUC_CN || MULTIBYTE == EUC_KR || MULTIBYTE == EUC_TW -# define OUT (USHRT_MAX+1) /* 2 bytes */ -# elif MULTIBYTE == UNICODE -# define OUT (USHRT_MAX+1) /* 2 bytes. assuming UCS-2 */ -# else -# define OUT (UCHAR_MAX+1) /* other codes. assuming 1 byte */ -# endif +# define OUT (16777216+1) /* 16777216 == 2^24 == 3 bytes */ #else # define OUT (CHAR_MAX+1) /* a non-character value */ #endif diff --git a/src/interfaces/libpq/Makefile.in b/src/interfaces/libpq/Makefile.in index 60994c9ff5018b12a6a6856c53615f4d855c60af..7dbe54f146939adc4d7ffcc071f5807c8b1282d0 100644 --- a/src/interfaces/libpq/Makefile.in +++ b/src/interfaces/libpq/Makefile.in @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.24 1998/07/24 03:32:33 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.25 1998/07/26 04:31:35 scrappy Exp $ # #------------------------------------------------------------------------- @@ -25,14 +25,14 @@ ifdef KRBVERS CFLAGS+= $(KRBFLAGS) endif -ifdef MB -CFLAGS+= -DMB=$(MB) +ifdef MULTIBYTE +CFLAGS+= $(MBFLAGS) endif OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \ dllist.o pqsignal.o -ifdef MB +ifdef MULTIBYTE OBJS+= common.o wchar.o conv.o endif @@ -42,7 +42,7 @@ install-shlib-dep := ifeq ($(PORTNAME), linux) install-shlib-dep := install-shlib - shlib := libpq.so.$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) + shlib := libpq.so.$(SO_MAJOR_VERSION) LDFLAGS_SL = -shared -soname libpq.so.$(SO_MAJOR_VERSION) CFLAGS += $(CFLAGS_SL) endif @@ -104,6 +104,19 @@ fe-lobj.o: $(SRCDIR)/backend/fmgr.h dllist.c: $(SRCDIR)/backend/lib/dllist.c -ln -s $(SRCDIR)/backend/lib/dllist.c . +ifdef MULTIBYTE +# We need to compile this with special options for shared libs, +# so we can't use the object in $(SRCDIR)/backend +common.c: $(SRCDIR)/backend/utils/mb/common.c + -ln -s $(SRCDIR)/backend/utils/mb/common.c . + +wchar.c: $(SRCDIR)/backend/utils/mb/wchar.c + -ln -s $(SRCDIR)/backend/utils/mb/wchar.c . + +conv.c: $(SRCDIR)/backend/utils/mb/conv.c + -ln -s $(SRCDIR)/backend/utils/mb/conv.c . +endif + # The following rules cause dependencies in the backend directory to # get made if they don't exist, but don't cause them to get remade if they # are out of date. diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 5029ec028b93592572d16277a44a869b0c86dbd8..1e306ee7dd2965287681fafde01367f80634d31e 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.76 1998/07/24 03:32:33 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.77 1998/07/26 04:31:36 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -44,7 +44,7 @@ #include <crypt.h> #endif -#ifdef MB +#ifdef MULTIBYTE #include "mb/pg_wchar.h" #endif @@ -792,7 +792,7 @@ PQsetenv(PGconn *conn) { struct EnvironmentOptions *eo; char setQuery[80]; /* mjl: size okay? XXX */ -#ifdef MB +#ifdef MULTIBYTE char *envname = "PGCLIENTENCODING"; char envbuf[64]; char *env; @@ -800,7 +800,7 @@ PQsetenv(PGconn *conn) PGresult *rtn; #endif -#ifdef MB +#ifdef MULTIBYTE /* query server encoding */ env = getenv(envname); if (!env) { @@ -815,7 +815,7 @@ PQsetenv(PGconn *conn) PQclear(rtn); } if (!encoding) { /* this should not happen */ - sprintf(envbuf,"%s=%s",envname,pg_encoding_to_char(MB)); + sprintf(envbuf,"%s=%s",envname,pg_encoding_to_char(MULTIBYTE)); putenv(envbuf); } } diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c index be1983ad7733729c1031777b1e57a34f524bf67c..4d6688e63a2aca17357459f98965599ec4299123 100644 --- a/src/interfaces/libpq/fe-print.c +++ b/src/interfaces/libpq/fe-print.c @@ -9,7 +9,7 @@ * didn't really belong there. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.7 1998/07/18 18:34:33 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.8 1998/07/26 04:31:36 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -36,8 +36,7 @@ #endif /* WIN32 */ #ifdef MULTIBYTE -#include "regex/pg_wchar.h" -#include "commands/variable.h" +#include "mb/pg_wchar.h" #endif #ifdef TIOCGWINSZ diff --git a/src/test/mb/mbregress.sh b/src/test/mb/mbregress.sh index cb376122ab0b39b095614acd660caa2e75a89684..2ef2eb04124a1cbb6bac7f92c0b66dfd946526b0 100644 --- a/src/test/mb/mbregress.sh +++ b/src/test/mb/mbregress.sh @@ -1,5 +1,5 @@ #! /bin/sh -# $Header: /cvsroot/pgsql/src/test/mb/mbregress.sh,v 1.1 1998/07/24 03:32:40 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/test/mb/mbregress.sh,v 1.2 1998/07/26 04:31:38 scrappy Exp $ if echo '\c' | grep -s c >/dev/null 2>&1 then @@ -10,6 +10,10 @@ else ECHO_C='\c' fi +if [ ! -d results ];then + mkdir results +fi + PSQL="psql -n -e -q" tests="euc_jp sjis euc_kr euc_cn unicode mule_internal" unset PGCLIENTENCODING diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index 0ac00215412595768bd0ee5affd2b0a411ed7533..e23eecdae79879118fbc2d3c81bd6a66ec5bbf96 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.15 1998/03/15 07:39:01 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.16 1998/07/26 04:31:41 scrappy Exp $ # #------------------------------------------------------------------------- @@ -50,7 +50,7 @@ all: $(INFILES) # run the test # runtest: $(INFILES) - MB=$(MB);export MB; \ + MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \ $(SHELL) ./regress.sh 2>&1 | tee regress.out @echo "ACTUAL RESULTS OF REGRESSION TEST ARE NOW IN FILE regress.out" diff --git a/src/test/regress/regress.sh b/src/test/regress/regress.sh index caa40033b80279f8fdeea33e6333ba57fb1dd3e8..488dab8c36fdab3f5e0ac49074433a5712dec453 100755 --- a/src/test/regress/regress.sh +++ b/src/test/regress/regress.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.19 1998/04/27 17:10:17 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.20 1998/07/26 04:31:41 scrappy Exp $ # if echo '\c' | grep -s c >/dev/null 2>&1 then @@ -42,8 +42,8 @@ fi echo "=============== running regression queries... =================" echo "" > regression.diffs -if [ a$MB != a ];then - mbtests=`echo $MB|tr "[A-Z]" "[a-z]"` +if [ -n "$MULTIBYTE" ];then + mbtests=`echo $MULTIBYTE|tr "[A-Z]" "[a-z]"` else mbtests="" fi