From c0b01461db59a472f5817a8c6e99091b8a48ffc5 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 24 Aug 1998 01:14:24 +0000 Subject: 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 --- src/backend/commands/copy.c | 61 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) (limited to 'src/backend/commands/copy.c') diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 34372db2a7d..5f974322a13 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.53 1998/08/19 02:01:44 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.54 1998/08/24 01:13:39 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -37,6 +37,10 @@ #include "commands/trigger.h" #include +#ifdef MULTIBYTE +#include "mb/pg_wchar.h" +#endif + #define ISOCTAL(c) (((c) >= '0') && ((c) <= '7')) #define VALUE(c) ((c) - '0') @@ -61,7 +65,7 @@ static char *CopyReadAttribute(FILE *fp, bool *isnull, char *delim, int *newline static char *CopyReadAttribute(FILE *fp, bool *isnull, char *delim); #endif -static void CopyAttributeOut(FILE *fp, char *string, char *delim, int is_array); +static void CopyAttributeOut(FILE *fp, unsigned char *string, char *delim, int is_array); static int CountTuples(Relation relation); extern FILE *Pfout, @@ -1006,6 +1010,17 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim) char c; int done = 0; int i = 0; +#ifdef MULTIBYTE + int mblen; + int encoding; + unsigned char s[2]; + int j; +#endif + +#ifdef MULTIBYTE + encoding = pg_get_client_encoding(); + s[1] = 0; +#endif #ifdef COPY_PATCH /* if last delimiter was a newline return a NULL attribute */ @@ -1108,19 +1123,53 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim) } if (!done) attribute[i++] = c; +#ifdef MULTIBYTE + s[0] = c; + mblen = pg_encoding_mblen(encoding, s); + mblen--; + for(j=0;j