diff options
| author | Bruce Momjian | 1998-06-16 07:29:54 +0000 |
|---|---|---|
| committer | Bruce Momjian | 1998-06-16 07:29:54 +0000 |
| commit | cb7cbc16fa4b5933fb5d63052568e3ed6859857b (patch) | |
| tree | bed17594c4880549288373de4d400512cbe2f82d /src/backend/libpq | |
| parent | 0d8e7f6381291b85ad6264365e01143357d70a75 (diff) | |
Hi, here are the patches to enhance existing MB handling. This time
I have implemented a framework of encoding translation between the
backend and the frontend. Also I have added a new variable setting
command:
SET CLIENT_ENCODING TO 'encoding';
Other features include:
Latin1 support more 8 bit cleaness
See doc/README.mb for more details. Note that the pacthes are
against May 30 snapshot.
Tatsuo Ishii
Diffstat (limited to 'src/backend/libpq')
| -rw-r--r-- | src/backend/libpq/Makefile | 6 | ||||
| -rw-r--r-- | src/backend/libpq/pqcomm.c | 44 |
2 files changed, 48 insertions, 2 deletions
diff --git a/src/backend/libpq/Makefile b/src/backend/libpq/Makefile index a608044fac..5176f2996a 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.11 1998/04/06 00:22:39 momjian Exp $ +# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.12 1998/06/16 07:29:22 momjian Exp $ # #------------------------------------------------------------------------- @@ -19,6 +19,10 @@ CFLAGS+= $(KRBFLAGS) LDFLAGS+= $(KRBLIBS) endif +ifdef MB +CFLAGS+= -DMB=$(MB) +endif + OBJS = be-dumpdata.o be-fsstubs.o be-pqexec.o pqcomprim.o\ auth.o hba.o crypt.o pqcomm.o portal.o util.o portalbuf.o pqpacket.o pqsignal.o \ password.o diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index a3ff7bcffd..9b699a22e4 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.44 1998/06/15 19:28:27 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.45 1998/06/16 07:29:23 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -23,6 +23,9 @@ * pq_putstr - send a null terminated string to connection * pq_putnchar - send n characters to connection * pq_putint - send an integer to connection + * pq_putncharlen - send n characters to connection + * (also send an int header indicating + * the length) * pq_getinaddr - initialize address from host and port number * pq_getinserv - initialize address from host and service name * pq_connect - create remote input / output connection @@ -66,6 +69,9 @@ #include "libpq/auth.h" #include "libpq/libpq.h" /* where the declarations go */ #include "storage/ipc.h" +#ifdef MB +#include "commands/variable.h" +#endif /* ---------------- * declarations @@ -180,6 +186,14 @@ pq_getstr(char *s, int maxlen) { int c = '\0'; +#ifdef MB + unsigned char *p, *ps; + int len; + + ps = s; + len = maxlen; +#endif + if (Pfin == (FILE *) NULL) { /* elog(DEBUG, "Input descriptor is null"); */ @@ -190,6 +204,13 @@ pq_getstr(char *s, int maxlen) *s++ = c; *s = '\0'; +#ifdef MB + p = pg_client_to_server(ps, len); + if (ps != p) { /* actual conversion has been done? */ + strcpy(ps, p); + } +#endif + /* ----------------- * If EOF reached let caller know. * (This will only happen if we hit EOF before the string @@ -325,7 +346,14 @@ pq_getint(int b) void pq_putstr(char *s) { +#ifdef MB + unsigned char *p; + + p = pg_server_to_client(s, strlen(s)); + if (pqPutString(p, Pfout)) +#else if (pqPutString(s, Pfout)) +#endif { sprintf(PQerrormsg, "FATAL: pq_putstr: fputs() failed: errno=%d\n", errno); @@ -788,3 +816,17 @@ StreamOpen(char *hostName, short portName, Port *port) return (STATUS_OK); } + +#ifdef MB +void +pq_putncharlen(char *s, int n) +{ + unsigned char *p; + int len; + + p = pg_server_to_client(s, n); + len = strlen(p); + pq_putint(len, sizeof(int)); + pq_putnchar(p, len); +} +#endif |
