Oracle9i Database Globalization Support Guide Release 2 (9.2) Part Number A96529-01 |
|
This chapter contains information useful for OCI programming. It includes the following topics:
Many OCI NLS functions accept either the environment handle or the user session handle. The OCI environment handle is associated with the client NLS environment and initialized with the client NLS environment variables. This environment does not change when ALTER
SESSION
statements are issued to the server. The character set associated with the environment handle is the client character set. The OCI session handle (returned by OCISessionBegin
) is associated with the server session environment. Its NLS settings change when the session environment is modified with an ALTER
SESSION
statement. The character set associated with the session handle is the database character set.
Note that the OCI session handle does not have any NLS settings associated with it until the first transaction begins in the session. SELECT
statements do not begin a transaction.
Use the OCIEnvNlsCreate
function to specify client-side database and national character sets when the OCI environment is created.This function allows users to set character set information dynamically in applications, independent of the NLS_LANG
and NLS_CHAR
initialization parameter settings. In addition, one application can initialize several environment handles for different client environments in the same server environment.
Any Oracle character set ID except AL16UTF16 can be specified through the OCIEnvNlsCreate
function to specify the encoding of metadata, SQL CHAR
data, and SQL NCHAR
data. Use OCI_UTF16ID
in the OCIEnvNlsCreate
function, introduced in Oracle 9i Release 2 (9.2), to specify UTF-16 data. Note that the OCI_UTF16
parameter in the OCIEnvCreate
function, which was introduced in Oracle9i release 1 (9.0.1) and was known as Unicode mode, has been deprecated.
See Also:
Oracle Call Interface Programmer's Guide for more information about the |
sword OCIEnvNlsCreate ( OCIEnv **envhpp, ub4 mode, dvoid *ctxp, dvoid *(*malocfp) (dvoid *ctxp, size_t size), dvoid *(*ralocfp) (dvoid *ctxp, dvoid *memptr, size_t newsize), void (*mfreefp) (dvoid *ctxp, dvoid *memptr)) size_t xtramemsz, dvoid **usrmempp ub2 charset, ub2 ncharset );
Creates and initializes an environment handle for OCI functions to work under. It is an enhanced version of the OCIEnvCreate()
function.
A pointer to an environment handle whose encoding setting is specified by mode
. The setting is inherited by statement handles derived from envhpp
.
Specifies initialization of the mode. Valid modes are:
OCI_DEFAULT
: The default value, which is non-UTF-16 encoding.OCI_THREADED
: Uses threaded environment. Internal data structures not exposed to the user are protected from concurrent accesses by multiple threads.OCI_OBJECT
: Uses object features.OCI_UTF16
: The environment handle and handles inherited from it assume UTF-16 encoding. This setting is deprecated. Instead, specify OCI_UTF16ID
for both charset
and ncharset
.OCI_SHARED
: Uses shared data structures.OCI_EVENTS
: Uses publish-subscribe notifications.OCI_NO_UCB
: Suppresses the calling of the OCIEnvCallback
dynamic callback routine. The default behavior is to allow calling of OCIEnvCallback
at the time that the environment is created.OCI_ENV_NO_MUTEX
: No mutexing in this mode. All OCI calls done on the environment handle, or on handles derived from the environment handle, must be serialized.Specifies the user-defined context for the memory callback routines.
Specifies the user-defined memory allocation function. If the mode is OCI_THREADED
, then this memory allocation routine must be thread-safe.
Specifies the context pointer for the user-defined memory allocation function.
Specifies the size of memory to be allocated by the user-defined memory allocation function.
Specifies the user-defined memory re-allocation function. If the mode is OCI_THREADED
, then this memory allocation routine must be thread-safe.
Specifies the context pointer for the user-defined memory reallocation function.
Pointer to memory block.
Specifies the new size of memory to be allocated
Specifies the user-defined memory free function. If the mode is OCI_THREADED
, then this memory-free routine must be thread-safe.
Specifies the context pointer for the user-defined memory-free function.
Pointer to memory to be freed
Specifies the amount of user memory to be allocated for the duration of the environment.
Returns a pointer to the user memory of size xtramemsz
allocated by the call for the user.
The client-side character set for the current environment handle. If it is 0
, then the NLS_LANG
setting is used. OCI_UTF16ID
is a valid setting. This affects metadata and CHAR
data.
The client-side national character set for the current environment handle. If it is 0
, then the NLS_NCHAR
setting is used. OCI_UTF16ID
is a valid setting. This affects NCHAR
data.
OCI_SUCCESS
: The environment handle has been successfully created.
OCI_ERROR
: An error occurred.
This function sets nonzero charset
and ncharset
as client-side database and national character sets, replacing the ones specified by NLS_LANG
and NLS_NCHAR
. When charset
and ncharset
are 0, it behaves exactly the same as OCIEnvCreate()
. Specifically, charset
controls the encoding for metadata and data with implicit form attribute and ncharset
controls the encoding for data with SQLCS_NCHAR
form attribute.
Although OCI_UTF16ID
can be set by OCIEnvNlsCreate()
, NLS_LANG
and NLS_NCHAR
cannot have a UTF-16 setting.
The character set IDs in NLS_LANG
and NLS_NCHAR
can be retrieved with OCINlsEnvironmentVariableGet()
.
This call returns an environment handle which is then used by the remaining OCI functions. There can be multiple environments in OCI, each with its own environment modes. This function also performs any process-level initialization if required by any mode. For example, if the user wants to initialize an environment as OCI_THREADED, then all libraries that are used by OCI are also initialized in the threaded mode.
If you are writing a DLL or a shared library using OCI library then this call should be used instead of OCIInitialize()
and OCIEnvInit()
calls.
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.
You can retrieve the following information with the OCINlsGetInfo()
function:
This section includes the following topics:
sword OCINlsGetInfo(dvoid *hndl, OCIError *errhp, OraText *buf, size_t buflen, ub2 item)
This function obtains locale information specified by item
from an OCI environment or user session handle (hndl
) into an array pointed to by buf
within a size limitation specified by buflen
.
OCI_SUCCESS
, OCI_INVALID_HANDLE
, or OCI_ERROR
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
Specifies which item in the OCI environment handle to return. It can be one of the following values:
OCI_NLS_DAYNAME1
: Native name for MondayOCI_NLS_DAYNAME2
: Native name for TuesdayOCI_NLS_DAYNAME3
: Native name for WednesdayOCI_NLS_DAYNAME4
: Native name for ThursdayOCI_NLS_DAYNAME5
: Native name for FridayOCI_NLS_DAYNAME6
: Native name for SaturdayOCI_NLS_DAYNAME7
: Native name for SundayOCI_NLS_ABDAYNAME1
: Native abbreviated name for MondayOCI_NLS_ABDAYNAME2
: Native abbreviated name for TuesdayOCI_NLS_ABDAYNAME3
: Native abbreviated name for WednesdayOCI_NLS_ABDAYNAME4
: Native abbreviated name for ThursdayOCI_NLS_ABDAYNAME5
: Native abbreviated name for FridayOCI_NLS_ABDAYNAME6
: Native abbreviated name for SaturdayOCI_NLS_ABDAYNAME7
: Native abbreviated name for SundayOCI_NLS_MONTHNAME1
: Native name for JanuaryOCI_NLS_MONTHNAME2
: Native name for FebruaryOCI_NLS_MONTHNAME3
: Native name for MarchOCI_NLS_MONTHNAME4
: Native name for AprilOCI_NLS_MONTHNAME5
: Native name for MayOCI_NLS_MONTHNAME6
: Native name for JuneOCI_NLS_MONTHNAME7
: Native name for JulyOCI_NLS_MONTHNAME8
: Native name for AugustOCI_NLS_MONTHNAME9
: Native name for SeptemberOCI_NLS_MONTHNAME10
: Native name for OctoberOCI_NLS_MONTHNAME11
: Native name for NovemberOCI_NLS_MONTHNAME12
: Native name for DecemberOCI_NLS_ABMONTHNAME1
: Native abbreviated name for JanuaryOCI_NLS_ABMONTHNAME2
: Native abbreviated name for FebruaryOCI_NLS_ABMONTHNAME3
: Native abbreviated name for MarchOCI_NLS_ABMONTHNAME4
: Native abbreviated name for AprilOCI_NLS_ABMONTHNAME5
: Native abbreviated name for MayOCI_NLS_ABMONTHNAME6
: Native abbreviated name for JuneOCI_NLS_ABMONTHNAME7
: Native abbreviated name for JulyOCI_NLS_ABMONTHNAME8
: Native abbreviated name for AugustOCI_NLS_ABMONTHNAME9
: Native abbreviated name for SeptemberOCI_NLS_ABMONTHNAME10
: Native abbreviated name for OctoberOCI_NLS_ABMONTHNAME11
: Native abbreviated name for NovemberOCI_NLS_ABMONTHNAME12
: Native abbreviated name for DecemberOCI_NLS_YES
: Native string for affirmative responseOCI_NLS_NO
: Native negative responseOCI_NLS_AM
: Native equivalent string of AMOCI_NLS_PM
: Native equivalent string of PMOCI_NLS_AD
: Native equivalent string of ADOCI_NLS_BC
: Native equivalent string of BCOCI_NLS_DECIMAL
: Decimal characterOCI_NLS_GROUP
: Group separatorOCI_NLS_DEBIT
: Native symbol of debitOCI_NLS_CREDIT
: Native symbol of creditOCI_NLS_DATEFORMAT
: Oracle date formatOCI_NLS_INT_CURRENCY
: International currency symbolOCI_NLS_DUAL_CURRENCY
: Dual currency symbolOCI_NLS_LOC_CURRENCY
: Locale currency symbolOCI_NLS_LANGUAGE
: Language nameOCI_NLS_ABLANGUAGE
: Abbreviation for language nameOCI_NLS_TERRITORY
: Territory nameOCI_NLS_CHARACTER_SET
: Character set nameOCI_NLS_LINGUISTIC_NAME
: Linguistic sort nameOCI_NLS_CALENDAR
: Calendar nameOCI_NLS_WRITING_DIR
: Language writing directionOCI_NLS_ABTERRITORY
: Territory abbreviationOCI_NLS_DDATEFORMAT
: Oracle default date formatOCI_NLS_DTIMEFORMAT
: Oracle default time formatOCI_NLS_SFDATEFORMAT
: Local date formatOCI_NLS_SFTIMEFORMAT
: Local time formatOCI_NLS_NUMGROUPING
: Number grouping fieldsOCI_NLS_LISTSEP
: List separatorOCI_NLS_MONDECIMAL
: Monetary decimal characterOCI_NLS_MONGROUP
: Monetary group separatorOCI_NLS_MONGROUPING
: Monetary grouping fieldsOCI_NLS_INT_CURRENCYSEP
: International currency separatorWhen 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
().
This example code retrieves information and checks for errors.
sword MyPrintLinguisticName(envhp, errhp) OCIEnv *envhp; OCIError *errhp; { OraText infoBuf[OCI_NLS_MAXBUFSZ]; sword ret; ret = OCINlsGetInfo(envhp, /* environment handle */ errhp, /* error handle */ infoBuf, /* destination buffer */ (size_t) OCI_NLS_MAXBUFSZ, /* buffer size */ (ub2) OCI_NLS_LINGUISTIC_NAME); /* item */ if (ret != OCI_SUCCESS) { checkerr(errhp, ret, OCI_HTYPE_ERROR); ret = OCI_ERROR; } else { printf("NLS linguistic: %s\n", infoBuf); } return(ret); }
ub2 OCINlsCharSetNameToId(dvoid *hndl, const oratext *name)
This function returns the Oracle character set ID for the specified Oracle character set name.
Character set ID if the specified character set name and the OCI handle are valid. Otherwise it returns 0
.
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.
sword OCINlsCharSetIdToName( dvoid *hndl, oratext *buf, size_t buflen, ub2 id)
This function returns the Oracle character set name from the specified character set ID.
OCI_SUCCESS
, OCI_INVALID_HANDLE
, or OCI_ERROR
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, the function returns OCI_ERROR
.
Oracle character set ID
sword OCINlsNumericInfoGet( dvoid *hndl, OCIError *errhp, sb4 *val, ub2 item)
This function obtains numeric language information specified by item
from the OCI environment handle into an output number variable.
OCI_SUCCESS
, OCI_INVALID_HANDLE
, or OCI_ERROR
OCI environment or session handle. If the handle is invalid, then the function returns OCI_INVALID_HANDLE
.
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 setReturns 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
datatypeOCI_NLS_NCHARSET_ID
: NLS_NCHAR
character set ID in ub2
datatypeSpecifies 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
OCI_SUCCESS
: The function finished successfully.
OCI_ERROR:
An error occurred.
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, tn 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
.
The OCINlsNameMap
function maps Oracle character set names, language names, and territory names to and from Internet Assigned Numbers Authority (IANA) and International Organization for Standardization (ISO) names.
sword OCINlsNameMap( dvoid *hndl, oratext *buf, size_t buflen, const oratext *srcbuf, uword flag)
This function maps Oracle character set names, language names, and territory names to and from IANA and ISO names.
OCI_SUCCESS
, OCI_INVALID_HANDLE
, or OCI_ERROR
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 requested name.
The size of the destination buffer. The recommended size is OCI_NLS_MAXBUFSZ
to guarantee storage of an NLS name. If the size of the destination buffer is smaller than the length of the name, then the function returns OCI_ERROR
.
Pointer to a null-terminated NLS name. If it is not a valid name, then the function returns OCI_ERROR
.
It specifies the direction of the name mapping and can take the following values:
OCI_NLS_CS_IANA_TO_ORA
: Map character set name from IANA to OracleOCI_NLS_CS_ORA_TO_IANA
: Map character set name from Oracle to IANA.OCI_NLS_LANG_ISO_TO_ORA
: Map language name from ISO to OracleOCI_NLS_LANG_ORA_TO_ISO
: Map language name from Oracle to ISOOCI_NLS_TERR_ISO_TO_ORA
: Map territory name from ISO to OracleOCI_NLS_TERR_ORA_TO_ISO
: Map territory name from Oracle to ISOOCI_NLS_TERR_ISO3_TO_ORA
: Map territory name from 3-letter ISO abbreviation to OracleOCI_NLS_TERR_ORA_TO_ISO3
: Map territory name from Oracle to 3-letter ISO abbreviationTwo types of data structures are supported for string manipulation:
Multibyte strings are encoded in native Oracle character sets. Functions that operate on multibyte strings take the string as a whole unit with the length of the string calculated in bytes. Wide character (wchar
) string functions provide more flexibility in string manipulation. They support character-based and string-based operations with the length the string calculated in characters.
The wide character datatype is Oracle-specific and should not be confused with the wchar_t
datatype defined by the ANSI/ISO C standard. The Oracle wide character datatype is always 4 bytes in all platforms, while the size of wchar_t
depends on the implementation and the platform. The Oracle wide character datatype normalizes multibyte characters so that they have a fixed width for easy processing. This guarantees no data loss for round-trip conversion between the Oracle wide character set and the native character set.
String manipulation can be classified into the following categories:
Table 8-1 summarizes the OCI string manipulation functions. They are described in more detail in the rest of this section.
sword OCIMultiByteToWideChar(dvoid *hndl, OCIWchar *dst, CONST OraText *src, size_t *rsize);
This routine converts an entire NULL
-terminated string into the wchar
format. The wchar
output buffer are NULL
-terminated. If OCI_UTF16ID
is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
OCI_SUCCESS
, OCI_INVALID_HANDLE
or OCI_ERROR
OCI environment or user session handle to determine the character set of string
Destination buffer for wchar
Source string to be converted
Number of characters converted including NULL
terminator. If it is a NULL
pointer, nothing to return
sword OCIMultiByteInSizeToWideChar(dvoid *hndl, OCIWchar *dst, size_t dstsz, CONST OraText *src, size_t srcsz, size_t *rsize)
This routine converts part of a string into the wchar
format. It converts as many complete characters as it can until it reaches the output buffer size limit or input buffer size limit or it reaches a NULL
terminator in a source string. The output buffer is NULL
-terminated if space permits. If dstsz
is zero, then this function returns only the number of characters not including the ending NULL
terminator needed for a converted string. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
OCI_SUCCESS
, OCI_INVALID_HANDLE
or OCI_ERROR
OCI environment or user session handle to determine the character set of the string
Pointer to a destination buffer for wchar
. It can be NULL
pointer when dstsz
is zero.
Destination buffer size in number of characters. If it is zero, this function just returns number of characters needed for the conversion.
Source string to be converted
Length of source string in bytes
Number of characters written into destination buffer, or number of characters for converted string if dstsz
is zero. If it is a NULL
pointer, nothing is returned.
sword OCIWideCharToMultiByte(dvoid *hndl, OraText *dst, CONST OCIWchar *src, size_t *rsize)
This routine converts an entire NULL
-terminated wide character string into a multibyte string. The output buffer is NULL
-terminated. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
OCI_SUCCESS
, OCI_INVALID_HANDLE
or OCI_ERROR
OCI environment or user session handle to determine the character set of string
Destination buffer for multibyte string
Source wchar
string to be converted
Length of source string in characters
Number of bytes written into destination buffer. If it is a NULL
pointer, then nothing is returned.
sword OCIWideCharInSizeToMultiByte(dvoid *hndl, OraText *dst, size_t dstsz, CONST OCIWchar *src, size_t srcsz, size_t *rsize)
This routine converts part of wchar
string into the multibyte format. It converts as many complete characters as it can until it reaches the output buffer size or the input buffer size or until it reaches a NULL
terminator in source string. The output buffer is NULL
-terminated if space permits. If dstsz
is zero, the function just returns the size of byte not including the NULL
terminator needed to store the converted string. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
OCI_SUCCESS
, OCI_INVALID_HANDLE
or OCI_ERROR
OCI environment or user session handle to determine the character set of string
Destination buffer for multibyte. It can be a NULL
pointer if dstsz
is zero
Destination buffer size in bytes. If it is zero, it returns the size in bytes need for converted string.
Source wchar
string to be converted
Length of source string in characters
Number of bytes written into destination buffer, or number of bytes need to store the converted string if dstsz
is zero. If it is a NULL
pointer, nothing is returned.
OCIWchar OCIWideCharToLower(dvoid *hndl, OCIWchar wc)
This function converts the wchar
character specified by wc
into the corresponding lowercase character if it exists in the specified locale. If no corresponding lowercase character exists, then it returns wc
itself. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate()
function, then this function produces an error.
A wchar
OCI environment or user session handle to determine the character set
wchar
for lowercase conversion
OCIWchar OCIWideCharToUpper(dvoid *hndl, OCIWchar wc)
This function converts the wchar
character specified by wc
into the corresponding uppercase character if it exists in the specified locale. If no corresponding uppercase character exists, then it returns wc
itself. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate()
function, then this function produces an error.
A wchar
OCI environment or user session handle to determine the character set
wchar
for uppercase conversion
int OCIWideCharStrcmp(dvoid *hndl, CONST OCIWchar *wstr1, CONST OCIWchar *wstr2, int flag)
It compares two wchar
strings by binary (based on wchar
encoding value), linguistic, or case-insensitive comparison methods. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
OCI environment or user session handle to determine the character set
Pointer to a NULL
-terminated wchar
string
Pointer to a NULL
-terminated wchar
string
Used to decide the comparison method. It can take one of the following values:
OCI_NLS_BINARY
: Binary comparison. This is the default value.OCI_NLS_LINGUISTIC
: Linguistic comparison specified in the locale definition.This flag can be used with OCI_NLS_CASE_INSENSITIVE
for case-insensitive comparison. For example, use OCI_NLS_LINGUISTIC|OCI_NLS_CASE_INSENSITIVE
to compare strings linguistically without regard to case.
int OCIWideCharStrncmp(dvoid *hndl, CONST OCIWchar *wstr1, size_t len1, CONST OCIWchar *wstr2, size_t len2, int flag)
This function is similar to OCIWideCharStrcmp
(). It compares two wide character strings by binary, linguistic, or case-insensitive comparison methods. At most len1
bytes from wstr1
and len2
bytes from wstr2
are compared. The NULL
terminator is used in the comparison. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
OCI environment or user session handle to determine the character set
Pointer to the first wchar
string
The length for the first string for comparison
Pointer to the second wchar
string
The length for the second string for comparison
It is used to decide the comparison method. It can take one of the following values:
OCI_NLS_BINARY
: For the binary comparison, this is default value.OCI_NLS_LINGUISTIC
: For the linguistic comparison specified in the locale.This flag can be used with OCI_NLS_CASE_INSENSITIVE
for case-insensitive comparison. For example, use OCI_NLS_LINGUISTIC|OCI_NLS_CASE_INSENSITIVE
to compare strings linguistically without regard to case.
size_t OCIWideCharStrcat(dvoid *hndl, OCIWchar *wdststr, CONST OCIWchar *wsrcstr)
This function appends a copy of the wchar
string pointed to by wsrcstr
, including the NULL
terminator to the wchar
string pointed to by wdststr
. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of characters in the result string, not including the NULL
terminator.
OCI environment or user session handle to determine the character set
Pointer to the destination wchar
string for appending
Pointer to the source wchar
string to append
size_t OCIWideCharStrncat(dvoid *hndl, OCIWchar *wdststr, CONST OCIWchar *wsrcstr, size_t n)
This function is similar to OCIWideCharStrcat
(). At most n
characters from wsrcstr
are appended to wdststr
. Note that the NULL
terminator in wsrcstr
stops appending. wdststr
is NULL
-terminated. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of characters in the result string, not including the NULL
terminator
OCI environment or user session handle to determine the character set
Pointer to the destination wchar
string to append
Pointer to the source wchar
string to append
Number of characters from wsrcstr
to append
OCIWchar *OCIWideCharStrchr(dvoid *hndl, CONST OCIWchar *wstr, OCIWchar wc)
This function searches for the first occurrence of wc
in the wchar
string pointed to by wstr
. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
A wchar
pointer if successful, otherwise a NULL
pointer
OCI environment or user session handle to determine the character set
Pointer to the wchar
string to search
wchar
to search for
OCIWchar *OCIWideCharStrrchr(dvoid *hndl, CONST OCIWchar *wstr, OCIWchar wc)
This function searches for the last occurrence of wc
in the wchar
string pointed to by wstr
. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
wchar
pointer if successful, otherwise a NULL
pointer
OCI environment or user session handle to determine the character set
Pointer to the wchar
string to search
wchar
to search for
size_t OCIWideCharStrcpy(dvoid *hndl, OCIWchar *wdststr, CONST OCIWchar *wsrcstr)
This function copies the wchar
string pointed to by wsrcstr
, including the NULL
terminator, into the array pointed to by wdststr
. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of characters copied not including the NULL
terminator
OCI environment or user session handle to determine the character set
Pointer to the destination wchar
buffer
Pointer to the source wchar
string
size_t OCIWideCharStrncpy(dvoid *hndl, OCIWchar *wdststr, CONST OCIWchar *wsrcstr, size_t n)
This function is similar to OCIWideCharStrcpy
(), except that at most n
characters are copied from the array pointed to by wsrcstr
to the array pointed to by wdststr
. Note that the NULL
terminator in wdststr
stops copying and the result string is NULL
-terminated. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of characters copied not including the NULL
terminator
OCI environment or user session handle to determine the character set
Pointer to the destination wchar
buffer
Pointer to the source wchar
string
Number of characters from wsrcstr
to copy
size_t OCIWideCharStrlen(dvoid *hndl, CONST OCIWchar *wstr)
This function computes the number of characters in the wchar
string pointed to by wstr
, not including the NULL
terminator, and returns this number. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of characters not including the NULL
terminator
OCI environment or user session handle to determine the character set
Pointer to the source wchar
string
size_t OCIWideCharStrCaseConversion(dvoid *hndl, OCIWchar *wdststr, CONST OCIWchar*wsrcstr, ub4 flag)
This function converts the wide char
string pointed to by wsrcstr
into the upper case or lower case specified by the flag and copies the result into the array pointed to by wdststr
. The result string is NULL
-terminated. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of characters for the result string, not including the NULL
terminator
OCI environment or user session handle
Pointer to destination array
Pointer to source string
Specify the case to convert:
This flag can be used with OCI_NLS_LINGUISTIC
to specify that the linguistic setting in the locale is used for case conversion.
size_t OCIWideCharDisplayLength(dvoid *hndl, OCIWchar wc)
This function determines the number of column positions required for wc
in display. It returns the number of column positions, or 0 if wc
is the NULL
terminator. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of display positions
OCI environment or user session handle to determine the character set
wchar
character
size_t OCIWideCharMultiByteLen(dvoid *hndl, OCIWchar wc)
This function determines the number of bytes required for wc
in multibyte encoding. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of bytes required for wc
OCI environment or user session handle to determine the character set
wchar
character
int OCIMultiByteStrcmp(dvoid *hndl, CONST OraText *str1, CONST OraText *str2, int flag)
It compares two multibyte strings by binary, linguistic, or case-insensitive comparison methods. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
OCI environment or user session handle
Pointer to a NULL
-terminated string
Pointer to a NULL
-terminated string
It is used to decide the comparison method. It can take one of the following values:
OCI_NLS_BINARY
: Binary comparison This is the default value.OCI_NLS_LINGUISTIC
: Linguistic comparison specified in the localeThis flag can be used with OCI_NLS_CASE_INSENSITIVE
for case-insensitive comparison. For example, use OCI_NLS_LINGUISTIC|OCI_NLS_CASE_INSENSITIVE
to compare strings linguistically without regard to case.
int OCIMultiByteStrncmp(dvoid *hndl, CONST OraText *str1, size_t len1, OraText *str2, size_t len2, int flag)
This function is similar to OCIMultiByteStrcmp
(), except that at most len1
bytes from str1
and len2
bytes from str2
are compared. The NULL
terminator is used in the comparison. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
OCI environment or user session handle
Pointer to the first string
The length for the first string for comparison
Pointer to the second string
The length for the second string for comparison
It is used to decide the comparison method. It can take one of the following values:
OCI_NLS_BINARY
: Binary comparison. This is the default value.OCI_NLS_LINGUISTIC
: Linguistic comparison specified in the localeThis flag can be used with OCI_NLS_CASE_INSENSITIVE
for case-insensitive comparison. For example, use OCI_NLS_LINGUISTIC|OCI_NLS_CASE_INSENSITIVE
to compare strings linguistically without regard to case.
size_t OCIMultiByteStrcat(dvoid *hndl, OraText *dststr, CONST OraText *srcstr)
This function appends a copy of the multibyte string pointed to by srcstr
, including the NULL
terminator to the end of string pointed to by dststr
. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of bytes in the result string, not including the NULL
terminator
OCI environment or user session handle to determine the character set
Pointer to the destination multibyte string for appending
Pointer to the source string to append
size_t OCIMultiByteStrncat(dvoid *hndl, OraText *dststr, CONST OraText *srcstr, size_t n)
This function is similar to OCIMultiByteStrcat
(). At most n
bytes from srcstr
are appended to dststr
. Note that the NULL
terminator in srcstr
stops appending and the function appends as many character as possible within n
bytes. dststr
is NULL
-terminated. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of bytes in the result string, not including the NULL
terminator
Pointer to OCI environment or user session handle
Pointer to the destination multibyte string for appending
Pointer to the source multibyte string to append
The number of bytes from srcstr
to append
size_t OCIMultiByteStrcpy(dvoid *hndl, OraText *dststr, CONST OraText *srcstr)
This function copies the multibyte string pointed to by srcstr
, including the NULL
terminator, into the array pointed to by dststr
. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of bytes copied, not including the NULL
terminator
Pointer to the OCI environment or user session handle
Pointer to the destination buffer
Pointer to the source multibyte string
size_t OCIMultiByteStrncpy(dvoid *hndl, OraText *dststr, CONST OraText *srcstr, size_t n)
This function is similar to OCIMultiByteStrcpy
(). At most n
bytes are copied from the array pointed to by srcstr
to the array pointed to by dststr
. Note that the NULL
terminator in srcstr
stops copying and the function copies as many characters as possible within n
bytes. The result string is NULL
-terminated. If OCI_UTF16ID
is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of bytes copied not including the NULL
terminator
Pointer to OCI environment or user session handle
Pointer to the destination buffer
Pointer to the source multibyte string
The number of bytes from srcstr
to copy
size_t OCIMultiByteStrlen(dvoid *hndl, CONST OraText *str)
This function returns the number of bytes in the multibyte string pointed to by str
, not including the NULL
terminator. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of bytes not including the NULL
terminator
Pointer to the OCI environment or user session handle
Pointer to the source multibyte string
size_t OCIMultiByteStrnDisplayLength(dvoid *hndl, CONST OraText *str1, size_t n)
This function returns the number of display positions occupied by the complete characters within the range of n
bytes. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of display positions
OCI environment or user session handle
Pointer to a multibyte string
The number of bytes to examine
size_t OCIMultiByteStrCaseConversion(dvoid *hndl, OraText *dststr, CONST OraText *srcstr, ub4 flag)
This function converts the multibyte string pointed to by srcstr
into upper case or lower case as specified by the flag and copies the result into the array pointed to by dststr
. The result string is NULL
-terminated. If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
The number of bytes for result string, not including the NULL
terminator
OCI environment or user session handle
Pointer to destination array
Pointer to source string
Specify the case to which to convert:
This flag can be used with OCI_NLS_LINGUISTIC
to specify that the linguistic setting in the locale is used for case conversion.
The following example shows a simple case of manipulating strings.
size_t MyConvertMultiByteToWideChar(envhp, dstBuf, dstSize, srcStr) OCIEnv *envhp; OCIWchar *dstBuf; size_t dstSize; OraText *srcStr; /* null terminated source string */ { sword ret; size_t dstLen = 0; size_t srcLen; /* get length of source string */ srcLen = OCIMultiByteStrlen(envhp, srcStr); ret = OCIMultiByteInSizeToWideChar(envhp, /* environment handle */ dstBuf, /* destination buffer */ dstSize, /* destination buffer size */ srcStr, /* source string */ srcLen, /* length of source string */ &dstLen); /* pointer to destination length */ if (ret != OCI_SUCCESS) { checkerr(envhp, ret, OCI_HTYPE_ENV); } return(dstLen); }
Table 8-2 shows the OCI character classification functions. They are described in more detail in the rest of this section.
boolean OCIWideCharIsAlnum(dvoid *hndl, OCIWchar wc)
It tests whether wc
is a letter or decimal digit.
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsAlpha(dvoid *hndl, OCIWchar wc)
It tests whether wc
is an alphabetic letter.
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsCntrl(dvoid *hndl, OCIWchar wc)
It tests whether wc
is a control character.
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsDigit(dvoid *hndl, OCIWchar wc)
It tests whether wc
is a decimal digit character.
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsGraph(dvoid *hndl, OCIWchar wc)
It tests whether wc
is a graph character. A graph character is a character with a visible representation and normally includes alphabetic letters, decimal digits, and punctuation.
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsLower(dvoid *hndl, OCIWchar wc)
It tests whether wc
is a lowercase letter.
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsPrint(dvoid *hndl, OCIWchar wc)
It tests whether wc
is a printable character.
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsPunct(dvoid *hndl, OCIWchar wc)
It tests whether wc
is a punctuation character.
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsSpace(dvoid *hndl, OCIWchar wc)
It tests whether wc
is a space character. A space character causes white space only in displayed text (for example, space, tab, carriage return, new line, vertical tab or form feed).
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsUpper(dvoid *hndl, OCIWchar wc)
It tests whether wc
is an uppercase letter.
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsXdigit(dvoid *hndl, OCIWchar wc)
It tests whether wc
is a hexadecimal digit (0-9, A-F, a-f).
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
boolean OCIWideCharIsSingleByte(dvoid *hndl, OCIWchar wc)
It tests whether wc
is a single-byte character when converted into multibyte.
TRUE
or FALSE
OCI environment or user session handle to determine the character set
wchar
for testing
The following example shows how to classify characters in OCI.
boolean MyIsNumberWideCharString(envhp, srcStr) OCIEnv *envhp; OCIWchar *srcStr; /* wide char source string */ { OCIWchar *pstr = srcStr; /* define and init pointer */ boolean status = TRUE; /* define and initialize status variable */ /* Check input */ if (pstr == (OCIWchar*) NULL) return(FALSE); if (*pstr == (OCIWchar) NULL) return(FALSE); /* check each character for digit */ do { if (OCIWideCharIsDigit(envhp, *pstr) != TRUE) { status = FALSE; break; /* non-decimal digit character */ } } while ( *++pstr != (OCIWchar) NULL); return(status); }
Conversion between Oracle character sets and Unicode (16-bit, fixed-width Unicode encoding) is supported. Replacement characters are used if a character has no mapping from Unicode to the Oracle character set. Therefore, conversion back to the original character set is not always possible without data loss.
Table 8-3 summarizes the OCI character set conversion functions. They are described in more detail in the rest of this section.
sword OCICharSetToUnicode(dvoid *hndl, ub2 *dst, size_t dstlen, CONST OraText *src, size_t srclen, size_t *rsize)
This function converts a multibyte string pointed to by src
to Unicode into the array pointed to by dst
. The conversion stops when it reaches the source limitation or destination limitation. The function returns the number of characters converted into a Unicode string. If dstlen
is 0
, then the function scans the string, counts the number of characters, and returns the number of characters into rsize
, but does not convert the string.
If OCI_UTF16ID is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
OCI_SUCCESS
, OCI_INVALID_HANDLE
or OCI_ERROR
Pointer to an OCI environment or user session handle
Pointer to a destination buffer
The size of the destination buffer in characters
Pointer to a multibyte source string
The size of the source string in bytes
The number of characters converted. If it is a NULL
pointer, then nothing is returned.
sword OCIUnicodeToCharSet(dvoid *hndl, OraText *dst, size_t dstlen, CONST ub2 *src, size_t srclen, size_t *rsize)
This function converts a Unicode string pointed to by src
to a multibyte string into the array pointed to by dst
. The conversion stops when it reaches the source limitation or destination limitation. The function returns the number of bytes converted into a multibyte string. If dstlen
is zero, it returns the number of bytes into rsize
without conversion.
If a Unicode character is not convertible for the character set specified in OCI environment or user session handle, a replacement character is used for it. In this case, OCICharsetConversionIsReplacementUsed
() returns TRUE
.
If OCI_UTF16ID
is specified for SQL CHAR
data in the OCIEnvNlsCreate
function, then this function produces an error.
OCI_SUCCESS
, OCI_INVALID_HANDLE
or OCI_ERROR
Pointer to an OCI environment or user session handle
Pointer to a destination buffer
The size of destination buffer in bytes
Pointer to a Unicode string
The size of the source string in characters
The number of bytes converted. If it is a NULL
pointer, nothing is returned.
sword OCINlsCharSetConvert(dvoid *envhp, OCIError *errhp,ub2 dstid, dvoid *dstp, size_t dstlen,ub2 srcid, CONST dvoid *srcp, size_tsrclen, size_t *rsize);
This function converts a string pointed to by src
in the character set specified by srcid
to the array pointed to by dst
in the character set specified by dstid
. The conversion stops when it reaches the data size limitation of either the source or the destination. The function returns the number of bytes converted into the destination buffer. Although either the source or the destination character set ID can be specified as OCI_UTF16ID
, the length of the original and the converted data is represented in bytes, rather than number of characters. Note that the conversion does not stop when it encounters null data. To get the character set ID from the character set name, use OCINlsCharSetNameToId()
. To check if derived data in the destination buffer contains replacement characters, use OCICharSetConversionIsReplacementUsed()
. The buffers should be aligned with the byte boundaries appropriate for the character sets. For example, the ub2
datatype should be used to hold strings in UTF-16.
OCI_SUCCESS
or OCI_ERROR
; number of bytes converted
OCI error handle. If there is an error, it is recorded in errhp
and the function returns a NULL
pointer. Diagnostic information can be obtained by calling OCIErrorGet()
.
Character set ID for the destination buffer
Pointer to the destination buffer
The maximum size in bytes of the destination buffer
Character set ID for the source buffer
Pointer to the source buffer
The length in bytes of the source buffer
The number of characters converted. If the pointer is NULL
, then nothing is returned.
boolean OCICharSetConversionIsReplacementUsed(dvoid *hndl)
This function indicates whether the replacement character was used for characters that could not be converted during the last invocation of OCICharSetToUnicode
() or OCICharSetConvert()
.
The function returns TRUE
if the replacement character was used when OCICharSetConvert
() or OCICharSetToUnicode()
was last invoked. Otherwise the function returns FALSE
.
Pointer to an OCI environment or user session handle
Conversion between the Oracle character set and Unicode (16-bit, fixed-width Unicode encoding) is supported. Replacement characters are used if there is no mapping for a character from Unicode to the Oracle character set. Thus, not every character can make a round-trip conversion to the original character. Data loss occurs with certain characters.
The following example shows a simple conversion into Unicode.
size_t MyConvertMultiByteToUnicode(envhp, dstBuf, dstSize, srcStr) OCIEnv *envhp; ub2 *dstBuf; size_t dstSize; OraText *srcStr; { sword ret; size_t dstLen = 0; size_t srcLen; /* get length of source string */ srcLen = OCIMultiByteStrlen(envhp, srcStr); ret = OCICharSetToUnicode(envhp, /* environment handle */ dstBuf, /* destination buffer */ dstSize, /* size of destination buffer */ srcStr, /* source string */ srcLen, /* length of source string */ &dstLen); /* pointer to destination length */ if (ret != OCI_SUCCESS) { checkerr(envhp, ret, OCI_HTYPE_ENV); } return(dstLen); }
The user message API provides a simple interface for cartridge developers to retrieve their own messages as well as Oracle messages.
Table 8-4 summarizes the OCI messaging functions.
This section contains the following topics:
sword OCIMessageOpen(dvoid *hndl, OCIError *errhp, OCIMsg **msghp, CONST OraText *product, CONST OraText *facility, OCIDuration dur)
This function opens a message-handling facility in a language pointed to by hndl
. It first tries to open the message file corresponding to hndl
. If it succeeds, then it uses that file to initialize a message handle. If it cannot find the message file that corresponds to the language, it looks for a primary language file as a fallback. For example, if the Latin American Spanish file is not found, then it tries to open the Spanish file. If the fallback fails, then it uses the default message file, whose language is AMERICAN
. The function returns a pointer to a message handle into the msghp
parameter.
OCI_SUCCESS
, OCI_INVALID_HANDLE,
or OCI_ERROR
Pointer to an OCI environment or user session handle for message language
The OCI error handle. If there is an error, it is recorded in errhp,
and the function returns a NULL
pointer. Diagnostic information can be obtained by calling OCIErrorGet()
.
A message handle for return
A pointer to a product name. The product name is used to locate the directory for messages. Its location depends on the operating system. For example, in Solaris, the directory of message files for the rdbms
product is $ORACLE_HOME/rdbms
.
A pointer to a facility name in the product. It is used to construct a message file name. A message file name follows the conversion with facility
as prefix. For example, the message file name for the img
facility in the American language is imgus.msb
, where us
is the abbreviation for the American language and msb
is the message binary file extension.
The duration for memory allocation for the return message handle. It can have the following values:
OraText *OCIMessageGet(OCIMsg *msgh, ub4 msgno, OraText *msgbuf, size_t buflen)
This function gets a message with the message number identified by msgno
. If buflen
is not zero, then the function copies the message into the buffer pointed to by msgbuf
. If buflen
is zero, then the message is copied into a message buffer inside the message handle pointed to by msgh
.
It returns the pointer to the NULL
-terminated message string. If the translated message cannot be found, then it tries to return the equivalent English message. If the equivalent English message cannot be found, then it returns a NULL
pointer.
Pointer to a message handle which was previously opened by OCIMessageOpen()
The message number for getting message
Pointer to a destination buffer for the retrieved message. If buflen
is zero, then it can be a NULL
pointer.
The size of the destination buffer
sword OCIMessageClose(dvoid *hndl, OCIError *errhp, OCIMsg *msgh)
This function closes a message handle pointed to by msgh
and frees any memory associated with this handle.
OCI_SUCCESS
, OCI_INVALID_HANDLE,
or OCI_ERROR
Pointer to an OCI environment or user session handle for message language
The OCI error handle. If there is an error, it is recorded in errhp
and the function returns a NULL
pointer. Diagnostic information can be obtained by calling OCIErrorGet()
.
A pointer to a message handle that was previously opened by OCIMessageOpen()
This example creates a message handle, initializes it to retrieve messages from impus.msg
, retrieves message number 128, and closes the message handle. It assumes that OCI environment handles, OCI session handles, product, facility, and cache size have been initialized properly.
OCIMsg msghnd; /* message handle */ /* initialize a message handle for retrieving messages from impus.msg*/ err = OCIMessageOpen(hndl,errhp, &msghnd, prod,fac,OCI_DURATION_SESSION); if (err != OCI_SUCCESS) /* error handling */ ... /* retrieve the message with message number = 128 */ msgptr = OCIMessageGet(msghnd, 128, msgbuf, sizeof(msgbuf)); /* do something with the message, such as display it */ ... /* close the message handle when there are no more messages to retrieve */
OCIMessageClose(hndl, errhp, msghnd);
The lmsgen
utility converts text-based message files (.msg
) into binary format (.msb
) so that Oracle messages and OCI messages provided by the user can be returned to OCI functions in the desired language.
LMSGENtext_file
product
facility
[language
]
text_file
is a message text file.product
is the name of the product.facility
is the name of the facility.language
is the optional message language corresponding to the language specified in the NLS_LANG
parameter. The language parameter is required if the message file is not tagged properly with language.
Text message files must follow these guidelines:
/
and //
are treated as internal comments and are ignored.# CHARACTER_SET_NAME= Japanese_Japan.JA16EUC
message_number
,warning_level
,message_text
The message number must be unique within a message file.
The warning level is not currently used. Use 0.
The message text cannot be longer than 76 bytes.
The following is an example of an Oracle message text file:
/ Copyright (c) 2001 by the Oracle Corporation. All rights reserved. / This is a test us7ascii message file # CHARACTER_SET_NAME= american_america.us7ascii / 00000, 00000, "Export terminated unsuccessfully\n" 00003, 00000, "no storage definition found for segment(%lu, %lu)"
The following table contains sample values for the lmsgen
parameters:
Parameter | Value |
---|---|
|
|
|
|
|
|
|
|
The text message file is found in the following location:
$HOME/myApp/mesg/impus.msg
One of the lines in the text message file is:
00128,2, "Duplicate entry %s found in %s"
The lmsgen
utility converts the text message file (impus.msg
) into binary format, resulting in a file called impus.msb
:
% lmsgen impus.msg $HOME/myApplication imp AMERICAN
The following output results:
Generating message file impus.msg --> /home/scott/myApplication/mesg/impus.msb NLS Binary Message File Generation Utility: Version 9.2.0.0.0 -Production Copyright (c) Oracle Corporation 1979, 2001. All rights reserved. CORE 9.2.0.0.0 Production
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|