Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

Appendix G.4 Character code type specification function

The character code type specification function is used to pass the type of the character code from a UAP to a hash function for table partitioning or a space conversion function.

By using this function to specify the type of the character code, you can execute processing that depends on the type of character code, such as the hash function for table partitioning and the space conversion function.

Prerequisites for using the character code type specification function
The prerequisites are the same as those for the hash function for table partitioning. For details, see G.1(1) Prerequisites for using the hash function for table partitioning.

Prerequisites for creating and executing a UAP using the character code type specification function
The prerequisites are the same as those for the hash function for table partitioning. For details, see G.1(2) Creating and executing UAPs that use the hash function for table partitioning.
Organization of this subsection
(1) Details about the character code type specification function

(1) Details about the character code type specification function

(a) Specification configuration

For details about the specification configuration, see G.1(3)(b) Specification configuration.

(b) Character code type specification function (p_rdb_set_lang)

Function
The character code type specification function specifies the type of character code to be handled by the hash function for table partitioning and the space conversion function.

Header file
#include<pdauxcnv.h>
This header file is required to use the character code type specification function.

Format
int p_rdb_set_lang(char *lang);

Arguments
lang (input)
Specifies the type of character encoding to be handled by the hash function for table partitioning and the space conversion function. Specifiable character encodings are as follows:
Type of character codes Value of lang argument
Shift JIS kanji codes1 "SJIS"
EUC Chinese kanji codes "CHINESE"
Single-byte character codes2 "C"
Unicodes (UTF-8) "UTF8"
1 Can be specified for Linux and Windows.
2 Can be specified for Windows.
If a blank character string (for example, p_rdb_set_lang ("")) is specified, the operation is as follows:
UNIX environment
The setlocale function executed before this function sets the character code type corresponding to the locale that was set to the LC_ALL category. If the setlocale function has not been executed, the character code type corresponding to the default locale of the LC_ALL category is set.
Windows environment
The default character code type of the OS is set. However, if the default character code type is set to a type that is not listed in the above table, the operation cannot be guaranteed.

Return values
data type: int
p_rdb_RC_RTRN(0)
Normal termination.
p_rdb_RC_ERRIVLG(-10)
Invalid character encoding type.

Notes
  1. You must execute p_rdb_set_lang if any of the following conditions is applicable:
    [Figure] When setting a character code type from a UAP in a Windows environment
    [Figure] When invoking p_rdb_conv_space_utf8 from a UAP in a UNIX environment*
    [Figure] When setting the character code type to SJIS from a UAP in a Linux environment
    [Figure] When setting the character code type to CHINESE from a UAP in a UNIX environment
    * Before invoking p_rdb_conv_space_utf8, execute p_rdb_set_lang. When invoking the space conversion function p_rdb_conv_space, use the setlocale function provided by the OS instead of p_rdb_set_lang.
  2. In an UNIX environment, after setting a character code type using this function, to use a character code type that cannot be used to use another function, issue p_rdb_set_lang("") first and then invoke the setlocale function to reset the character code type to an appropriate one.