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

Commit1350059

Browse files
committed
Recongizing PGCLIENTENCODING has been broken since 7.0.
1 parentf68b847 commit1350059

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.127 2000/05/21 21:19:53 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.127.2.1 2000/11/17 04:25:29 ishii Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1505,17 +1505,31 @@ PQsetenvPoll(PGconn *conn)
15051505
{
15061506
constchar*env;
15071507

1508-
/* query server encoding */
15091508
env=getenv(envname);
15101509
if (!env||*env=='\0')
15111510
{
1511+
/* query server encoding if PGCLIENTENCODING
1512+
is not specified */
15121513
if (!PQsendQuery(conn,
15131514
"select getdatabaseencoding()"))
15141515
gotoerror_return;
15151516

15161517
conn->setenv_state=SETENV_STATE_ENCODINGS_WAIT;
15171518
returnPGRES_POLLING_READING;
15181519
}
1520+
else
1521+
{
1522+
/* otherwise set client encoding in pg_conn struct */
1523+
intencoding=pg_char_to_encoding(env);
1524+
if (encoding<0)
1525+
{
1526+
strcpy(conn->errorMessage.data,
1527+
"PGCLIENTENCODING has no valid encoding name.\n");
1528+
gotoerror_return;
1529+
}
1530+
conn->client_encoding=encoding;
1531+
}
1532+
15191533
}
15201534

15211535
caseSETENV_STATE_ENCODINGS_WAIT:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp