CREATE CONVERSION 中文man页面

系统
CREATE CONVERSION 定义一种新的编码转换。 转换的名字可以用在 convert 函数内部声明特定的编码转换。 同样,标记为 DEFAULT 的转换可以用于在前端和后端之间的自动编码转换。 出于这个原因,我们必须定义两种转换,从编码 A 到 B 以及从编码 B 到 A。

NAME

CREATE CONVERSION - 定义一个用户定义的码制转换

SYNOPSIS

CREATE [DEFAULT] CONVERSION name
    FOR source_encoding TO dest_encoding FROM funcname

DESCRIPTION 描述

CREATE CONVERSION 定义一种新的编码转换。 转换的名字可以用在 convert 函数内部声明特定的编码转换。 同样,标记为 DEFAULT 的转换可以用于在前端和后端之间的自动编码转换。 出于这个原因,我们必须定义两种转换,从编码 A 到 B 以及从编码 B 到 A。


 为了可以创建转换,你必须在函数上有EXECUTE权限并且有在目标模式上的CREATE权限。  

PARAMETERS 参数

DEFAULT
DEFAULT 子句表示这种转换对于从这种源编码到目的编码的情况是缺省的。在一个模式里每个编码对应该只有一个缺省编码。
name

 转换的名字。转换名可以用模式修饰。如果没有,那么转换就在当前模式中定义。转换名在一个模式里必须***。
source_encoding

 源编码名。
dest_encoding

 目的编码名。
funcname

 用于执行转换的函数。这个函数名可以用模式名修饰。 如果没有,那么将从路径中找出这个函数。


 此函数必须有如下的样子:

conv_proc(
    integer,  -- 源编码 ID
    integer,  -- 目的编码 ID
    cstring,  -- 源字串(空结尾的 C 字串)
    cstring,  -- 目的字串(空结尾的 C 字串)
    integer   -- 源字串长度
) RETURNS void;

NOTES 注意


 使用 DROP CONVERSION 删除用户定义的转换。


 创建转换所需要的权限可能在未来的版本中改变。  

EXAMPLES 例子


 用 myfunc 创建一个从编码 UNICODE 到 LATIN1 的转换:

CREATE CONVERSION myconv FOR 'UNICODE' TO 'LATIN1' FROM myfunc;

COMPATIBILITY 兼容性

CREATE CONVERSION 是 PostgreSQL 的扩展。 在 SQL 标准里没有CREATE CONVERSION 语句。  

SEE ALSO 参见

ALTER CONVERSION [alter_conversion(7)], CREATE FUNCTION [create_function(l)], DROP CONVERSION [drop_conversion(l)]  

#p#

NAME

CREATE CONVERSION - define a new conversion

SYNOPSIS

CREATE [DEFAULT] CONVERSION name
    FOR source_encoding TO dest_encoding FROM funcname

DESCRIPTION

CREATE CONVERSION defines a new encoding conversion. Conversion names may be used in the convert function to specify a particular encoding conversion. Also, conversions that are marked DEFAULT can be used for automatic encoding conversion between client and server. For this purpose, two conversions, from encoding A to B and from encoding B to A, must be defined.

To be able to create a conversion, you must have EXECUTE privilege on the function and CREATE privilege on the destination schema.  

PARAMETERS

DEFAULT
The DEFAULT clause indicates that this conversion is the default for this particular source to destination encoding. There should be only one default encoding in a schema for the encoding pair.
name
The name of the conversion. The conversion name may be schema-qualified. If it is not, the conversion is defined in the current schema. The conversion name must be unique within a schema.
source_encoding
The source encoding name.
dest_encoding
The destination encoding name.
funcname
The function used to perform the conversion. The function name may be schema-qualified. If it is not, the function will be looked up in the path.

The function must have the following signature:

conv_proc(
    integer,  -- source encoding ID
    integer,  -- destination encoding ID
    cstring,  -- source string (null terminated C string)
    cstring,  -- destination string (null terminated C string)
    integer   -- source string length
) RETURNS void;

NOTES

Use DROP CONVERSION to remove user-defined conversions.

The privileges required to create a conversion may be changed in a future release.  

EXAMPLES

To create a conversion from encoding UNICODE to LATIN1 using myfunc:

CREATE CONVERSION myconv FOR 'UNICODE' TO 'LATIN1' FROM myfunc;

COMPATIBILITY

CREATE CONVERSION is a PostgreSQL extension. There is no CREATE CONVERSION statement in the SQL standard.  

SEE ALSO

ALTER CONVERSION [alter_conversion(7)], CREATE FUNCTION [create_function(l)], DROP CONVERSION [drop_conversion(l)]

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-24 14:13:27

DROP CONVER中文man

2011-08-24 09:14:47

alter_conve中文man

2011-08-24 11:15:24

CREATE INDE中文man

2011-08-24 13:36:25

CREATE TRIG中文man

2011-08-24 13:46:39

CREATE VIEW中文man

2011-08-24 10:46:36

CREATE AGGR中文man

2011-08-24 13:43:09

CREATE USER中文man

2011-08-24 13:29:20

CREATE TABL中文man

2011-08-24 13:32:56

CREATE TABL中文man

2011-08-24 13:26:19

CREATE SEQU中文man

2011-08-24 13:39:44

CREATE TYPE中文man

2011-08-24 11:18:53

CREATE LANG中文man

2011-08-24 11:10:17

CREATE GROU中文man

2011-08-24 13:23:10

CREATE SCHE中文man

2011-08-24 11:31:47

CREATE RULE中文man

2011-08-24 11:05:36

CREATE FUNC中文man

2011-08-24 11:02:11

CREATE DOMA中文man

2011-08-24 10:59:19

CREATE DATA中文man

2011-08-24 11:23:20

CREATE OPER中文man

2011-08-24 10:53:20

CREATE CONS中文man
点赞
收藏

51CTO技术栈公众号