Commit afde2acc authored by Tatsuo Ishii's avatar Tatsuo Ishii

Recongizing PGCLIENTENCODING has been broken since 7.0.

parent 2912c287
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.147 2000/11/14 01:15:06 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.148 2000/11/17 04:22:52 ishii Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1608,10 +1608,11 @@ keep_going: /* We will come back to here until there ...@@ -1608,10 +1608,11 @@ keep_going: /* We will come back to here until there
{ {
const char *env; const char *env;
/* query server encoding */
env = getenv(envname); env = getenv(envname);
if (!env || *env == '\0') if (!env || *env == '\0')
{ {
/* query server encoding if PGCLIENTENCODING
is not specified */
if (!PQsendQuery(conn, if (!PQsendQuery(conn,
"select getdatabaseencoding()")) "select getdatabaseencoding()"))
goto error_return; goto error_return;
...@@ -1619,6 +1620,19 @@ keep_going: /* We will come back to here until there ...@@ -1619,6 +1620,19 @@ keep_going: /* We will come back to here until there
conn->setenv_state = SETENV_STATE_ENCODINGS_WAIT; conn->setenv_state = SETENV_STATE_ENCODINGS_WAIT;
return PGRES_POLLING_READING; return PGRES_POLLING_READING;
} }
else
{
/* otherwise set client encoding in pg_conn struct */
int encoding = pg_char_to_encoding(env);
if (encoding < 0)
{
strcpy(conn->errorMessage.data,
"PGCLIENTENCODING has no valid encoding name.\n");
goto error_return;
}
conn->client_encoding = encoding;
}
} }
case SETENV_STATE_ENCODINGS_WAIT: case SETENV_STATE_ENCODINGS_WAIT:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment