The unichar, univarchar, and unitext datatypes have been added for Unicode support in the Server Option. These three datatypes are mapped to TDS_LONGBINARY with a user type of 34, 35, or 36, as shown in Table 4.
SQL datatype |
TDS datatype |
User type |
Comment |
---|---|---|---|
unichar |
TDS_LONGBINARY |
34 |
Fixed-length UTF-16 data |
univarchar |
TDS_LONGBINARY |
35 |
Variable-length UTF-16 data |
unitext |
TDS_LONGBINARY |
36 |
UTF-16 encoded data |
The Server Option has the following three datatypes to support unichar, univarchar, and unitext:
TDSUNICHAR – Internal type 26
TDSUNIVARCHAR – Internal type 27
TDSUNITEXT – Internal type 28
Currently, there is no special support for TDSUNITEXT.
The following API calls have been changed in the Server Option to accommodate support for Unicode:
The TDPROPS API call maintains character set conversion properties.
COPY SYGWCOB 01 TDSPROC PIC S9(9) COMP. 01 RETCODE PIC S9(9) COMP. 01 OPER PIC S9(9) COMP. 01 PROPERTY PIC S9(9) COMP. 01 VALUE PIC S9(9) COMP. CALL ‘TDPROPS’ USING TDSPROC RETCODE OPER PROPERTY VALUE.
Argument |
Description |
---|---|
TDPROC |
(I) Handle for this client-server connection. |
RETCODE |
(O) Variable in which the result of function execution is returned. |
OPER |
(I) To retrieve the property specified by PROPERTY, set to TDS-GET; to change the property specified by PROPERTY, set to TDS-SET. |
PROPERTY |
(I). TDPROPS supports the following properties:
|
VALUE |
(I) The value of the property specified in PROPERTY. |
For a connection established with the UTF-8 character set, the default values for the TDS_CLIENT_CCSID, TDS_SERVER_CCSID, TDS_PROG_CCSID, and TDS_DATA_CCSID parameters are 1208, 1208, 500, and 500, respectively.
TDPROPS may specify values for these properties any time after a connection has been established. The default values for these properties depend on the character set established for the connection at login.
The Server Option does not reset any CCSID property values set by an application program. Once an application changes a CCSID property value, the setting remains for all API calls until it is reset by the application.
TDS_PROG_CCSID is set to 1208 (UTF-8), and both TDS_SERVER_CCSID and TDS_CLIENT_CCSID default to 1208. The server application program calls TDRCVPRM.
When the server reads data from the client, the data is in UTF-8.
When a Server Option application requests data from the server, the data is retrieved in UTF-8.
TDS_PROG_CCSID is set to 1025 (Russian EBCDIC, CCSID=1025), and both TDS_SERVER_CCSID and TDS_CLIENT_CCSID default to 1208. The application calls TDRCVPRM:
When data is read by the server from the client, the data is in UTF-8.
When data is requested by the Server Option application from the server, the data is retrieved in EBCDIC CCSID=1025.
TDS_PROG_CCSID is set to 939 (Japanese EBCDIC, CCSID=939), and both TDS_SERVER_CCSID and TDS_CLIENT_CCSID default to sjis (CCSID=943). The application calls TDRCVPRM:
When data is read by the server from the client, the data is in sjis.
When data is requested by the Server Option application from the server, the data is retrieved in EBCDIC CCSID=939.
The TDESCRIB API call now allows use of the TDSUNICHAR, TDSUNIVARCHAR, and TDSUNITEXT datatypes.
Table 5 lists new datatype conversions supported.
Datatype |
Datatype |
---|---|
TDSCHAR |
TDSUNICHAR |
TDSCHAR |
TDSUNIVARCHAR |
TDSCHAR |
TDSUNITEXT |
TDSVARCHAR |
TDSUNICHAR |
TDSVARCHAR |
TDSUNIVARCHAR |
TDSTEXT |
TDSUNITEXT |