Scalable Database Server, HiRDB Version 8 UAP Development Guide
Appendix G.4 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
- You must execute p_rdb_set_lang if any of the following conditions is applicable:
When setting a character code type from a UAP in a Windows environment
When invoking p_rdb_conv_space_utf8 from a UAP in a UNIX environment*
When setting the character code type to SJIS from a UAP in a Linux environment
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.
- 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.
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.