mb support fix

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: pgsql-patches(at)postgreSQL(dot)org
Cc: hackers(at)postgreSQL(dot)org
Subject: mb support fix
Date: 1999-01-27 00:59:38
Message-ID: 199901270059.JAA25483@srapc451.sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Included patches fix a portability problem of unsetenv() used in
6.4.2 multi-byte support. unsetenv() is only avaliable on FreeBSD and
Linux so I decided to replace with putenv().
--
Tatsuo Ishii
t-ishii(at)sra(dot)co(dot)jp
----------------------------- cut here ----------------------------
*** postgresql-6.4.2/src/bin/psql/psql.c.orig Wed Jan 6 13:25:45 1999
--- postgresql-6.4.2/src/bin/psql/psql.c Wed Jan 6 13:26:27 1999
***************
*** 1498,1504 ****
PGCLIENTENCODING value. -- 1998/12/12 Tatsuo Ishii */

if (!has_client_encoding) {
! unsetenv("PGCLIENTENCODING");
}
#endif

--- 1498,1505 ----
PGCLIENTENCODING value. -- 1998/12/12 Tatsuo Ishii */

if (!has_client_encoding) {
! static const char ev[] = "PGCLIENTENCODING=";
! putenv(ev);
}
#endif

*** postgresql-6.4.2/src/interfaces/libpq/fe-print.c.orig Wed Jan 6 13:27:21 1999
--- postgresql-6.4.2/src/interfaces/libpq/fe-print.c Wed Jan 6 13:29:19 1999
***************
*** 506,512 ****
int encoding = -1;

str = getenv("PGCLIENTENCODING");
! if (str)
encoding = pg_char_to_encoding(str);
if (encoding < 0)
encoding = MULTIBYTE;
--- 506,512 ----
int encoding = -1;

str = getenv("PGCLIENTENCODING");
! if (str && *str != NULL)
encoding = pg_char_to_encoding(str);
if (encoding < 0)
encoding = MULTIBYTE;
*** postgresql-6.4.2/src/interfaces/libpq/fe-connect.c.orig Wed Jan 6 13:29:47 1999
--- postgresql-6.4.2/src/interfaces/libpq/fe-connect.c Wed Jan 6 13:30:55 1999
***************
*** 813,819 ****
#ifdef MULTIBYTE
/* query server encoding */
env = getenv(envname);
! if (!env)
{
rtn = PQexec(conn, "select getdatabaseencoding()");
if (rtn && PQresultStatus(rtn) == PGRES_TUPLES_OK)
--- 813,819 ----
#ifdef MULTIBYTE
/* query server encoding */
env = getenv(envname);
! if (!env || *env == NULL)
{
rtn = PQexec(conn, "select getdatabaseencoding()");
if (rtn && PQresultStatus(rtn) == PGRES_TUPLES_OK)

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1999-01-27 01:18:12 Re: [PATCHES] mb support fix
Previous Message The Hermit Hacker 1999-01-26 23:46:35 Re: alloca (was: Postgres Speed or lack thereof)