1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-15 03:41:20 +03:00

o note that now pg_database has a new attribuite "encoding" even

if MULTIBYTE is not enabled. So be sure to run initdb.

o these patches are made against the latest source tree (after
Bruce's massive patch, I think) BTW, I noticed that after running
regression, the oid field of pg_type seems disappeared.

	regression=> select oid from pg_type; ERROR:  attribute
	'oid' not found

this happens after the constraints test. This occures with/without
my patches. strange...

o pg_database_mb.h, pg_class_mb.h, pg_attribute_mb.h are no longer
used, and shoud be removed.

o GetDatabaseInfo() in utils/misc/database.c removed (actually in
#ifdef 0). seems nobody uses.

t-ishii@sra.co.jp
This commit is contained in:
Bruce Momjian
1998-08-24 01:14:24 +00:00
parent 9438fe5d09
commit c0b01461db
27 changed files with 171 additions and 815 deletions

View File

@@ -4,7 +4,7 @@
# Makefile for utils/cache
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/cache/Makefile,v 1.8 1998/07/26 04:30:54 scrappy Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/cache/Makefile,v 1.9 1998/08/24 01:13:52 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -12,9 +12,6 @@ SRCDIR = ../../..
include ../../../Makefile.global
CFLAGS += -I../..
ifdef MULTIBYTE
CFLAGS+= $(MBFLAGS)
endif
OBJS = catcache.o inval.o rel.o relcache.o syscache.o lsyscache.o fcache.o

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.15 1998/08/19 02:03:09 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.16 1998/08/24 01:13:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,11 +22,7 @@
#include "catalog/pg_type.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_language.h"
#ifdef MULTIBYTE
#include "catalog/pg_class_mb.h"
#else
#include "catalog/pg_class.h"
#endif
#include "parser/parsetree.h" /* for getrelname() */
#include "utils/builtins.h"
#include "utils/fcache.h"

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.33 1998/08/11 18:28:28 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.34 1998/08/24 01:13:56 momjian Exp $
*
* NOTES
* InitPostgres() is the function called from PostgresMain
@@ -67,10 +67,7 @@
#include "catalog/catname.h"
#ifdef MULTIBYTE
#include "catalog/pg_database_mb.h"
#include "mb/pg_wchar.h"
#else
#include "catalog/pg_database.h"
#endif
#include "libpq/libpq.h"
@@ -83,11 +80,7 @@ static void InitStdio(void);
static void InitUserid(void);
extern char *ExpandDatabasePath(char *name);
#ifdef MULTIBYTE
extern void GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encoding);
#else
extern void GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path);
#endif
static IPCKey PostgresIpcKey;
@@ -128,16 +121,10 @@ InitMyDatabaseInfo(char *name)
int4 owner;
char *path,
myPath[MAXPGPATH + 1];
#ifdef MULTIBYTE
int encoding;
#endif
SetDatabaseName(name);
#ifdef MULTIBYTE
GetRawDatabaseInfo(name, &owner, &MyDatabaseId, myPath, &encoding);
#else
GetRawDatabaseInfo(name, &owner, &MyDatabaseId, myPath);
#endif
if (!OidIsValid(MyDatabaseId))
elog(FATAL,

View File

@@ -2,7 +2,7 @@
* conversion between client encoding and server internal encoding
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
* $Id: conv.c,v 1.1 1998/07/24 03:31:56 scrappy Exp $
* $Id: conv.c,v 1.2 1998/08/24 01:13:59 momjian Exp $
*/
#include <stdio.h>
#include <string.h>
@@ -369,7 +369,38 @@ static void mic2latin5(unsigned char *mic, unsigned char *p, int len)
mic2latin(mic, p, len, LC_ISO8859_5);
}
/*
* ASCII ---> MIC
*/
static void ascii2mic(unsigned char *l, unsigned char *p, int len)
{
int c1;
while (len-- > 0 && (c1 = *l++)) {
*p++ = (c1 & 0x7f);
}
*p = '\0';
}
/*
* MIC ---> ASCII
*/
static void mic2ascii(unsigned char *mic, unsigned char *p, int len)
{
int c1;
while (len > 0 && (c1 = *mic)) {
if (c1 > 0x7f) {
printBogusChar(&mic, &p);
} else { /* should be ASCII */
*p++ = c1;
}
}
*p = '\0';
}
pg_encoding_conv_tbl pg_conv_tbl[] = {
{SQL_ASCII, "SQL_ASCII", 0, ascii2mic, mic2ascii}, /* SQL/ACII */
{EUC_JP, "EUC_JP", 0, euc_jp2mic, mic2euc_jp}, /* EUC_JP */
{EUC_CN, "EUC_CN", 0, euc_cn2mic, mic2euc_cn}, /* EUC_CN */
{EUC_KR, "EUC_KR", 0, euc_kr2mic, mic2euc_kr}, /* EUC_KR */

View File

@@ -1,7 +1,7 @@
/*
* conversion functions between pg_wchar and multi-byte streams.
* Tatsuo Ishii
* $Id: wchar.c,v 1.1 1998/07/24 03:31:57 scrappy Exp $
* $Id: wchar.c,v 1.2 1998/08/24 01:14:01 momjian Exp $
*/
#include "mb/pg_wchar.h"
@@ -316,6 +316,7 @@ static int pg_sjis_mblen(const unsigned char *s)
}
pg_wchar_tbl pg_wchar_table[] = {
{0, 0},
{pg_eucjp2wchar_with_len, pg_eucjp_mblen},
{pg_euccn2wchar_with_len, pg_euccn_mblen},
{pg_euckr2wchar_with_len, pg_euckr_mblen},
@@ -347,7 +348,6 @@ pg_wchar_tbl pg_wchar_table[] = {
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, pg_sjis_mblen}
};

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.16 1998/08/19 02:03:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.17 1998/08/24 01:14:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,7 +30,11 @@
#include "utils/builtins.h"
#include "utils/syscache.h"
#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
#endif
#ifdef 0
/* GetDatabaseInfo()
* Pull database information from pg_database.
*/
@@ -102,6 +106,7 @@ GetDatabaseInfo(char *name, int4 *owner, char *path)
return FALSE;
} /* GetDatabaseInfo() */
#endif
char *
ExpandDatabasePath(char *dbpath)
@@ -175,7 +180,7 @@ ExpandDatabasePath(char *dbpath)
* --------------------------------
*/
void
GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path)
GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encoding)
{
int dbfd;
int fileflags;
@@ -262,13 +267,25 @@ GetRawDatabaseInfo(char *name, int4 *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 MULTIBYTE
*encoding = tup_db->encoding;
#endif
goto done;
}