2.3.46 Operands related to character encoding

188) pd_substr_length = 3 | 4 | 5 | 6
Specifies the maximum number of bytes used to represent a single character. This operand is applicable when Unicode (UTF-8) is specified as the character encoding and affects the length of the results of the SUBSTR scalar function.
For details about the SUBSTR scalar function, see the manual HiRDB Version 8 SQL Reference.
Specification guidelines
If you use only characters in the range of UCS-2 (1 to 3 bytes), you can omit this operand. To use characters in the range of UCS-4 (1 to 6 bytes), you must specify the maximum number of bytes used to represent a single character.
If the specified value is greater than the actual number of bytes used to represent a single character, the result of the SUBSTR scalar function may become long. Therefore, evaluate the value to be specified in this operand on the basis of the character encoding actually used.
Notes
  • According to the ISO/IEC Standard 10646, a range of 1 to 4 bytes is assigned per character and bytes 5 and 6 are reserved for future standards. Although HiRDB supports a range of 1 to 6 bytes per character, problems may be introduced in the future if you use a range of 5 or 6 bytes but no characters have been assigned using that number of bytes.
  • In Unicode (UTF-8) supported by version 06-02, you can use a maximum of 3 bytes per character. Version 08-00 supports a maximum of 6 bytes. Therefore, with some data, the number of bytes representing a single character may increase.
  • If all the following conditions are satisfied, you must re-create SQL objects in routines and re-define view tables:
    [Figure]Unicode (UTF-8) is specified as the character encoding.
    [Figure]A value other than 3 is to be specified in the new pd_substr_length operand; or, in an environment where the pd_substr_length operand has already been specified, routines and view tables are to be defined and the pd_substr_length operand value is to be changed.
    [Figure]A SUBSTR scalar function specifying the mixed character string type (MCHAR or MVARCHAR) as its argument is to be specified in routines and view definitions.
    You can specify the PDSUBSTRLEN operand in the client environment definition to control each connection, or you can specify the SUBSTR LENGTH SQL compile option to control each routine.
  • The tables below show the priority among the pd_substr_length operand and other operands when Unicode (UTF-8) is specified as the character encoding.
    When control is performed for each routine
    Control timingpd_substr_length operandClient environment definition
    PDSUBSTRLEN
    SQL compile option
    SUBSTR LENGTH
    Remarks
    During definitionValid (2)InvalidValid (1)Default value
    pd_substr_length
    During call or function callInvalid
    (depends on the specification made during definition)
    Invalid
    (depends on the specification made during definition)
    [Figure]None
    Legend:
    ( ): Priority level
    [Figure]: Cannot be specified
    When control is performed for each view table
    Control timingpd_substr_length operandClient environment definition
    PDSUBSTRLEN
    SQL compile option
    SUBSTR LENGTH
    Remarks
    During definitionValid (2)Valid (1)[Figure]Default value
    pd_substr_length
    During operationInvalid
    (depends on the specification made during definition)
    Invalid
    (depends on the specification made during definition)
    [Figure]None
    Legend:
    ( ): Priority level
    [Figure]: Cannot be specified