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

Commitbe471a9

Browse files
committed
Current multi-byte related codes have a bug with SQL_ASCII
support. Included patches will solve it and should be applied toboth trees. Also, it fix the problem with \c command of psql whenswitching different encoding databases.Regression tests passed.--Tatsuo Ishiit-ishii@sra.co.jp
1 parent4d7ffd4 commitbe471a9

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

‎src/backend/utils/mb/conv.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* conversion between client encoding and server internal encoding
33
* (currently mule internal code (mic) is used)
44
* Tatsuo Ishii
5-
* $Id: conv.c,v 1.3 1998/09/01 04:33:21 momjian Exp $
5+
* $Id: conv.c,v 1.3.2.1 1998/12/14 04:51:33 momjian Exp $
66
*/
77
#include<stdio.h>
88
#include<string.h>
@@ -487,14 +487,15 @@ mic2ascii(unsigned char *mic, unsigned char *p, int len)
487487
{
488488
intc1;
489489

490-
while (len>0&& (c1=*mic))
490+
while (len-->0&& (c1=*mic))
491491
{
492492
if (c1>0x7f)
493493
printBogusChar(&mic,&p);
494494
else
495495
{/* should be ASCII */
496496
*p++=c1;
497497
}
498+
mic++;
498499
}
499500
*p='\0';
500501
}

‎src/bin/psql/psql.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.163.2.1 1998/11/24 05:50:42 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.163.2.2 1998/12/14 04:51:34 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -84,6 +84,11 @@ char *__progname = "psql";
8484

8585
#endif
8686

87+
#ifdefMULTIBYTE
88+
/* flag to indicate if PGCLIENTENCODING has been set by a user */
89+
staticinthas_client_encoding;
90+
#endif
91+
8792
/* This prompt string is assumed to have at least 3 characters by code in MainLoop().
8893
* A character two characters from the end is replaced each time by a mode character.
8994
*/
@@ -1485,6 +1490,18 @@ do_connect(const char *new_dbname,
14851490
/* FIXME: if changing user, ought to prompt for a new password? */
14861491
pwparam=PQpass(olddb);
14871492

1493+
#ifdefMULTIBYTE
1494+
/* PGCLIENTENCODING may be set by the previous connection.
1495+
if a user does not explicitly set PGCLIENTENCODING,
1496+
we should discard PGCLIENTENCODING so that
1497+
libpq could get the backend encoding as the default
1498+
PGCLIENTENCODING value. -- 1998/12/12 Tatsuo Ishii */
1499+
1500+
if (!has_client_encoding) {
1501+
unsetenv("PGCLIENTENCODING");
1502+
}
1503+
#endif
1504+
14881505
pset->db=PQsetdbLogin(PQhost(olddb),PQport(olddb),
14891506
NULL,NULL,dbparam,userparam,pwparam);
14901507

@@ -2754,6 +2771,10 @@ main(int argc, char **argv)
27542771
settings.getPassword=0;
27552772
#endif
27562773

2774+
#ifdefMUTIBYTE
2775+
has_client_encoding=getenv("PGCLIENTENCODING");
2776+
#endif
2777+
27572778
while ((c=getopt(argc,argv,"Aa:c:d:ef:F:lh:Hnso:p:qStT:ux"))!=EOF)
27582779
{
27592780
switch (c)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp