mirror of https://github.com/postgres/postgres
Add a new function "pg_client_encoding" which returns the current client
side encoding name. This is necessary for client API's such as JDBC to perform correct encoding conversions. See my email "[HACKERS] pg_client_encoding" 10 Sep 2001.
This commit is contained in:
parent
9d13fcf0af
commit
f426465ba9
|
@ -1,4 +1,4 @@
|
|||
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.77 2001/10/10 00:02:42 petere Exp $ -->
|
||||
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.78 2001/10/12 02:08:34 ishii Exp $ -->
|
||||
|
||||
<chapter id="functions">
|
||||
<title>Functions and Operators</title>
|
||||
|
@ -1008,6 +1008,16 @@
|
|||
<entry><literal>trim</literal></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><function>pg_client_encoding</function>()</entry>
|
||||
<entry><type>name</type></entry>
|
||||
<entry>
|
||||
Returns current client encoding name.
|
||||
</entry>
|
||||
<entry><literal>pg_client_encoding()</literal></entry>
|
||||
<entry><literal>SQL_ASCII</literal></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><function>repeat</function>(<type>text</type>, <type>integer</type>)</entry>
|
||||
<entry><type>text</type></entry>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.77 2001/09/08 15:24:00 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.78 2001/10/12 02:08:34 ishii Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -197,6 +197,12 @@ getdatabaseencoding(PG_FUNCTION_ARGS)
|
|||
return DirectFunctionCall1(namein, CStringGetDatum("SQL_ASCII"));
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_client_encoding(PG_FUNCTION_ARGS)
|
||||
{
|
||||
return DirectFunctionCall1(namein, CStringGetDatum("SQL_ASCII"));
|
||||
}
|
||||
|
||||
Datum
|
||||
PG_encoding_to_char(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* client encoding and server internal encoding.
|
||||
* (currently mule internal code (mic) is used)
|
||||
* Tatsuo Ishii
|
||||
* $Id: mbutils.c,v 1.23 2001/09/21 15:27:38 tgl Exp $
|
||||
* $Id: mbutils.c,v 1.24 2001/10/12 02:08:34 ishii Exp $
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
|
@ -471,3 +471,10 @@ getdatabaseencoding(PG_FUNCTION_ARGS)
|
|||
Assert(DatabaseEncoding);
|
||||
return DirectFunctionCall1(namein, CStringGetDatum(DatabaseEncoding->name));
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_client_encoding(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Assert(ClientEncoding);
|
||||
return DirectFunctionCall1(namein, CStringGetDatum(ClientEncoding->name));
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pg_proc.h,v 1.215 2001/10/03 17:22:05 tgl Exp $
|
||||
* $Id: pg_proc.h,v 1.216 2001/10/12 02:08:34 ishii Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The script catalog/genbki.sh reads this file and generates .bki
|
||||
|
@ -2140,10 +2140,14 @@ DESCR("return portion of string");
|
|||
|
||||
/* for multi-byte support */
|
||||
|
||||
/* old encoding names - back compatibility only */
|
||||
/* return database encoding name */
|
||||
DATA(insert OID = 1039 ( getdatabaseencoding PGUID 12 f t f t 0 f 19 "0" 100 0 0 100 getdatabaseencoding - ));
|
||||
DESCR("encoding name of current database");
|
||||
|
||||
/* return client encoding name i.e. session encoding */
|
||||
DATA(insert OID = 810 ( pg_client_encoding PGUID 12 f t f t 0 f 19 "0" 100 0 0 100 pg_client_encoding - ));
|
||||
DESCR("encoding name of current database");
|
||||
|
||||
DATA(insert OID = 1717 ( convert PGUID 12 f t f t 2 f 25 "25 19" 100 0 0 100 pg_convert - ));
|
||||
DESCR("convert string with specified destination encoding name");
|
||||
|
||||
|
|
Loading…
Reference in New Issue