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

Commitf426465

Browse files
committed
Add a new function "pg_client_encoding" which returns the current client
side encoding name. This is necessary for client API's such as JDBCto perform correct encoding conversions. See my email "[HACKERS]pg_client_encoding" 10 Sep 2001.
1 parent9d13fcf commitf426465

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.77 2001/10/10 00:02:42 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.78 2001/10/1202:08:34 ishii Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -1008,6 +1008,16 @@
10081008
<entry><literal>trim</literal></entry>
10091009
</row>
10101010

1011+
<row>
1012+
<entry><function>pg_client_encoding</function>()</entry>
1013+
<entry><type>name</type></entry>
1014+
<entry>
1015+
Returns current client encoding name.
1016+
</entry>
1017+
<entry><literal>pg_client_encoding()</literal></entry>
1018+
<entry><literal>SQL_ASCII</literal></entry>
1019+
</row>
1020+
10111021
<row>
10121022
<entry><function>repeat</function>(<type>text</type>, <type>integer</type>)</entry>
10131023
<entry><type>text</type></entry>

‎src/backend/utils/init/miscinit.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.77 2001/09/08 15:24:00 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.78 2001/10/12 02:08:34 ishii Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -197,6 +197,12 @@ getdatabaseencoding(PG_FUNCTION_ARGS)
197197
returnDirectFunctionCall1(namein,CStringGetDatum("SQL_ASCII"));
198198
}
199199

200+
Datum
201+
pg_client_encoding(PG_FUNCTION_ARGS)
202+
{
203+
returnDirectFunctionCall1(namein,CStringGetDatum("SQL_ASCII"));
204+
}
205+
200206
Datum
201207
PG_encoding_to_char(PG_FUNCTION_ARGS)
202208
{

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* client encoding and server internal encoding.
44
* (currently mule internal code (mic) is used)
55
* Tatsuo Ishii
6-
* $Id: mbutils.c,v 1.23 2001/09/21 15:27:38 tgl Exp $
6+
* $Id: mbutils.c,v 1.24 2001/10/12 02:08:34 ishii Exp $
77
*/
88
#include"postgres.h"
99

@@ -471,3 +471,10 @@ getdatabaseencoding(PG_FUNCTION_ARGS)
471471
Assert(DatabaseEncoding);
472472
returnDirectFunctionCall1(namein,CStringGetDatum(DatabaseEncoding->name));
473473
}
474+
475+
Datum
476+
pg_client_encoding(PG_FUNCTION_ARGS)
477+
{
478+
Assert(ClientEncoding);
479+
returnDirectFunctionCall1(namein,CStringGetDatum(ClientEncoding->name));
480+
}

‎src/include/catalog/pg_proc.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_proc.h,v 1.215 2001/10/03 17:22:05 tgl Exp $
10+
* $Id: pg_proc.h,v 1.216 2001/10/12 02:08:34 ishii Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -2140,10 +2140,14 @@ DESCR("return portion of string");
21402140

21412141
/* for multi-byte support */
21422142

2143-
/*oldencodingnames - back compatibility only */
2143+
/*return databaseencodingname */
21442144
DATA(insertOID=1039 (getdatabaseencodingPGUID12ftft0f19"0"10000100getdatabaseencoding- ));
21452145
DESCR("encoding name of current database");
21462146

2147+
/* return client encoding name i.e. session encoding */
2148+
DATA(insertOID=810 (pg_client_encodingPGUID12ftft0f19"0"10000100pg_client_encoding- ));
2149+
DESCR("encoding name of current database");
2150+
21472151
DATA(insertOID=1717 (convertPGUID12ftft2f25"25 19"10000100pg_convert- ));
21482152
DESCR("convert string with specified destination encoding name");
21492153

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp