*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include "commands/trigger.h"
#include
-#ifdef MB
+#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
#endif
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
}
if (!done) {
attribute[i++] = c;
-#ifdef MB
+#ifdef MULTIBYTE
s[0] = c;
mblen = pg_encoding_mblen(encoding, s);
mblen--;
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]);
{
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
fputc('\\', fp);
}
}
-#ifdef MB
+#ifdef MULTIBYTE
for (i=0;i
fputc(*(string+i), fp);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#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"
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)
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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include
#include
#include
-#ifdef MB
+#ifdef MULTIBYTE
#include
#else
#include
#include
#include
-#ifdef MB
+#ifdef MULTIBYTE
#include
#else
#include
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#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"
* 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 $
*
*/
#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_;
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
{
# 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 $
#
#-------------------------------------------------------------------------
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\
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include "libpq/libpq.h" /* where the declarations go */
#include "storage/ipc.h"
#ifdef MULTIBYTE
-#include "commands/variable.h"
+#include "mb/pg_wchar.h"
#endif
/* ----------------
# 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 $
#
#-------------------------------------------------------------------------
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 \
*
*
* 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
#include "utils/elog.h"
#include "access/xact.h"
-#ifdef MB
+#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
#endif
}
n->dbname = $3;
n->dbpath = $5;
-#ifdef MB
+#ifdef MULTIBYTE
if ($6 != NULL) {
n->encoding = pg_char_to_encoding($6);
if (n->encoding < 0) {
CreatedbStmt *n = makeNode(CreatedbStmt);
n->dbname = $3;
n->dbpath = NULL;
-#ifdef MB
+#ifdef MULTIBYTE
n->encoding = GetTemplateEncoding();
#endif
$$ = (Node *)n;
# 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 $
#
#-------------------------------------------------------------------------
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
#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)
# 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 $
#
#-------------------------------------------------------------------------
include ../../Makefile.global
CFLAGS += -I..
-ifdef MB
-CFLAGS += -DMB=$(MB)
+ifdef MULTIBYTE
+CFLAGS+= $(MBFLAGS)
endif
OBJS = rewriteRemove.o rewriteDefine.o \
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#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"
# 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 $
#
#-------------------------------------------------------------------------
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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include "catalog/catname.h"
#include "catalog/catalog.h"
-#ifdef MB
+#ifdef MULTIBYTE
#include "catalog/pg_class_mb.h"
#else
#include "catalog/pg_class.h"
# 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 $
#
#-------------------------------------------------------------------------
CFLAGS += -I../..
-ifdef MB
-CFLAGS += -DMB=$(MB)
+ifdef MULTIBYTE
+CFLAGS+= $(MBFLAGS)
endif
OBJS = md.o mm.o smgr.o smgrtype.o
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
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);
# 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 $
#
#-------------------------------------------------------------------------
CFLAGS+= -I..
-ifdef MB
-CFLAGS+= -DMB=$(MB)
+ifdef MULTIBYTE
+CFLAGS+= $(MBFLAGS)
endif
ifeq ($(CC), gcc)
*
*
* 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
#endif
#ifdef MULTIBYTE
-#include "commands/variable.h"
+#include "mb/pg_wchar.h"
#endif
/* ----------------
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 $");
}
/* ----------------
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*ps_status = commandTag = "CREATEDB";
CHECK_IF_ABORTED();
-#ifdef MB
+#ifdef MULTIBYTE
createdb(stmt->dbname, stmt->dbpath, stmt->encoding);
#else
createdb(stmt->dbname, stmt->dbpath);
# 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 $
#
#-------------------------------------------------------------------------
DIRS = adt cache error fmgr hash init misc mmgr sort time
-ifdef MB
+ifdef MULTIBYTE
OBJS += mb/SUBSYS.o
DIRS += mb
endif
# 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 $
#
#-------------------------------------------------------------------------
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 \
# 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 $
#
#-------------------------------------------------------------------------
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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#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"
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#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"
# 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 $
#
#-------------------------------------------------------------------------
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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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 *
*
*
* 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
#include "utils/inval.h"
#include "catalog/catname.h"
-#ifdef MB
+#ifdef MULTIBYTE
#include "catalog/pg_database_mb.h"
#include "mb/pg_wchar.h"
#else
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);
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);
path = ExpandDatabasePath(myPath);
SetDatabasePath(path);
-#ifdef MB
+#ifdef MULTIBYTE
SetDatabaseEncoding(encoding);
#endif
# 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 $
#
#-------------------------------------------------------------------------
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
* 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
#include
/*
* fuctions for utils/init
*/
-static int DatabaseEncoding = MB;
+static int DatabaseEncoding = MULTIBYTE;
void
SetDatabaseEncoding(int encoding)
{
# 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 $
#
#-------------------------------------------------------------------------
CFLAGS += -I../..
-ifdef MB
-CFLAGS += -DMB=$(MB)
+ifdef MULTIBYTE
+CFLAGS+= $(MBFLAGS)
endif
OBJS = database.o superuser.o
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#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
* --------------------------------
*/
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)
* 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;
#
#
# 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 $
#
#-------------------------------------------------------------------------
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
#
#
# 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 $
#
#-------------------------------------------------------------------------
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)/$<
#
#
# 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
#
#
# 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 $
#
#-------------------------------------------------------------------------
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)/$<
#
#
# 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 $
#
#-------------------------------------------------------------------------
#
#
# 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 $
#
#-------------------------------------------------------------------------
OBJS= pg_encoding.o
-CFLAGS+= -DMB=$(MB) -I$(SRCDIR)/include
+CFLAGS+= $(MBFLAGS) -I$(SRCDIR)/include
all: pg_encoding
#
#
# 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 $
#
#-------------------------------------------------------------------------
CFLAGS+= $(KRBFLAGS)
endif
-ifdef MB
-CFLAGS+= -DMB=$(MB)
+ifdef MULTIBYTE
+CFLAGS+= $(MBFLAGS)
endif
OBJS= psql.o stringutils.o @STRDUP@
AC_MSG_RESULT(disabled)
)
-AC_MSG_CHECKING(setting MB)
+AC_MSG_CHECKING(setting MULTIBYE)
AC_ARG_WITH(mb,
[ --with-mb= 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")
)
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'
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
#define SIGKILLDAEMON1 SIGTERM
-#ifdef MB
+#ifdef MULTIBYTE
extern void createdb(char *dbname, char *dbpath, int encoding);
#else
extern void createdb(char *dbname, char *dbpath);
* 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
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 */
-/* $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
/* 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
#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 */
extern void SetTemplateEncoding(int);
extern int GetTemplateEncoding(void);
-#endif /* MB */
+#endif /* MULTIBYTE */
#endif /* PG_WCHAR_H */
*
* 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
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);
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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
/* 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
#
#
# 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 $
#
#-------------------------------------------------------------------------
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
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
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.
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include
#endif
-#ifdef MB
+#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
#endif
{
struct EnvironmentOptions *eo;
char setQuery[80]; /* mjl: size okay? XXX */
-#ifdef MB
+#ifdef MULTIBYTE
char *envname = "PGCLIENTENCODING";
char envbuf[64];
char *env;
PGresult *rtn;
#endif
-#ifdef MB
+#ifdef MULTIBYTE
/* query server encoding */
env = getenv(envname);
if (!env) {
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);
}
}
* 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 $
*
*-------------------------------------------------------------------------
*/
#endif /* WIN32 */
#ifdef MULTIBYTE
-#include "regex/pg_wchar.h"
-#include "commands/variable.h"
+#include "mb/pg_wchar.h"
#endif
#ifdef TIOCGWINSZ
#! /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
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
#
#
# 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 $
#
#-------------------------------------------------------------------------
# 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"
#!/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
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