Oracle® Call Interface Programmer's Guide 10g Release 1 (10.1) Part Number B10779-01 |
|
|
View PDF |
This section describes the OCI locale functions.
An Oracle locale consists of language, territory, and character set definitions. The locale determines conventions such as day and month names, as well as date, time, number, and currency formats. A globalized application obeys a user's locale setting and cultural conventions. For example, when the locale is set to German, users expect to see day and month names in German.
Returns the Oracle character set name from the specified character set ID.
sword OCINlsCharSetIdToName ( dvoid *hndl, oratext *buf, size_t buflen ub2 id );
OCI environment or session handle. If the handle is invalid, then the function returns OCI_INVALID_HANDLE
.
Points to the destination buffer. If the function returns OCI_SUCCESS
, then the parameter contains a NULL
-terminated string for the character set name.
The size of the destination buffer. The recommended size is OCI_NLS_MAXBUFSZ
to guarantee storage for an Oracle character set name. If the size of the destination buffer is smaller than the length of the character set name, then the function returns OCI_ERROR
.
Oracle character set ID
OCI_SUCCESS
, OCI_INVALID_HANDLE
, or OCI_ERROR
Returns the Oracle character set ID for the specified Oracle character set name.
ub2 OCINlsCharSetNameToId ( dvoid *hndl, CONST oratext *name );
OCI environment or session handle. If the handle is invalid, then the function returns zero.
Pointer to a NULL
-terminated Oracle character set name. If the character set name is invalid, then the function returns zero.
Character set ID if the specified character set name and the OCI handle are valid. Otherwise, it returns 0
.
Returns the character set ID from NLS_LANG
or the national character set id from NLS_NCHAR
.
sword OCINlsEnvironmentVariableGet ( dvoid *val, size_t size, ub2 item, ub2 charset, size_t *rsize );
Returns a value of an NLS environment variable such as the NLS_LANG
character set ID or the NLS_NCHAR
character set ID.
Specifies the size of the given output value, which is applicable only to string data. The maximum length for each piece of information is OCI_NLS_MAXBUFSZ bytes. In the case of numeric data, this argument is ignored.
Specifies one of the following values to get from the NLS environment variable:
OCI_NLS_CHARSET_ID
: NLS_LANG
character set ID in ub2
datatype.OCI_NLS_NCHARSET_ID
: NLS_NCHAR
character set ID in ub2
datatype.Specifies the character set ID for retrieved string data. If it is 0
, then the NLS_LANG
value is used. OCI_UTF16ID
is a valid value for this argument. In the case of numeric data, this argument is ignored.
The length of the return value in bytes.
Following NLS convention, the national character set ID is the same as the character set ID if NLS_NCHAR
is not set. If NLS_LANG
is not set, then the default character set ID is returned.
To allow for future enhancements of this function (to retrieve other values from environment variables) the datatype of the output val
is a pointer to dvoid
. String data is not terminated by NULL
.
Note that the function does not take an environment handle, so the character set ID and the national character set ID that it returns are the values specified in NLS_LANG
and NLS_NCHAR
, instead of the values saved in the OCI environment handle. To get the character set IDs used by the OCI environment handle, call OCIAttrGet()
for OCI_ATTR_ENV_CHARSET
and OCI_ATTR_ENV_NCHARSET
, respectively.
OCI_SUCCESS or OCI_ERROR
Obtains locale information from an OCI environment or user session handle into an array pointed to by the destination buffer within a specified size.
sword OCINlsGetInfo ( dvoid *hndl, OCIError *errhp, OraText *buf, size_t buflen, ub2 item );
The OCI environment or user session handle initialized in object mode.
The OCI error handle. If there is an error, then it is recorded in errhp
and the function returns a NULL
pointer. Diagnostic information can be obtained by calling OCIErrorGet()
.
Pointer to the destination buffer. Returned strings are terminated by a NULL
character.
The size of the destination buffer. The maximum length for each piece of information is OCI_NLS_MAXBUFSZ
bytes.
OCI_NLS_MAXBUFSIZE: When calling OCINlsGetInfo
(), you need to allocate the buffer to store the returned information. The buffer size depends on which item you are querying and what encoding you are using to store the information. Developers should not need to know how many bytes it takes to store January
in Japanese using JA16SJIS encoding. The OCI_NLS_MAXBUFSZ attribute guarantees that the buffer is big enough to hold the largest item returned by OCINlsGetInfo
().
Specifies which item in the OCI environment handle to return. It can be one of the following values:
OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR
Obtains numeric language information from the OCI environment handle and puts it into an output number variable.
sword OCINlsNumericInfoGet ( dvoid *hndl, OCIError *errhp, sb4 *val, ub2 item );
The OCI error handle. If there is an error, then it is recorded in errhp
and the function returns a NULL
pointer. Diagnostic information can be obtained by calling OCIErrorGet()
.
Pointer to the output number variable. If the function returns OCI_SUCCESS
, then the parameter contains the requested NLS numeric information.
It specifies which item to get from the OCI environment handle and can be one of following values:
OCI_NLS_CHARSET_MAXBYTESZ
: Maximum character byte size for OCI environment or session handle character setOCI_NLS_CHARSET_FIXEDWIDTH
: Character byte size for fixed-width character set; 0
for variable-width character setOCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR