Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitafde2ac

Browse files
committed
Recongizing PGCLIENTENCODING has been broken since 7.0.
1 parent2912c28 commitafde2ac

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.147 2000/11/14 01:15:06 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.148 2000/11/17 04:22:52 ishii Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1608,17 +1608,31 @@ PQsetenvPoll(PGconn *conn)
16081608
{
16091609
constchar*env;
16101610

1611-
/* query server encoding */
16121611
env=getenv(envname);
16131612
if (!env||*env=='\0')
16141613
{
1614+
/* query server encoding if PGCLIENTENCODING
1615+
is not specified */
16151616
if (!PQsendQuery(conn,
16161617
"select getdatabaseencoding()"))
16171618
gotoerror_return;
16181619

16191620
conn->setenv_state=SETENV_STATE_ENCODINGS_WAIT;
16201621
returnPGRES_POLLING_READING;
16211622
}
1623+
else
1624+
{
1625+
/* otherwise set client encoding in pg_conn struct */
1626+
intencoding=pg_char_to_encoding(env);
1627+
if (encoding<0)
1628+
{
1629+
strcpy(conn->errorMessage.data,
1630+
"PGCLIENTENCODING has no valid encoding name.\n");
1631+
gotoerror_return;
1632+
}
1633+
conn->client_encoding=encoding;
1634+
}
1635+
16221636
}
16231637

16241638
caseSETENV_STATE_ENCODINGS_WAIT:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp