OCILIB (C Driver for Oracle) 3.9.1
|
OCILIB supports ANSI and Unicode charsets
Oracle started a real Unicode support with Oracle8i but only for user data. All SQL and PL/SQ/ statements, metadata string, database objects names, etc, ... were still only supported in ANSI.
With Oracle 9i, Oracle provides a full Unicode support.
So depending on the compile time Oracle library or the runtime loaded library, the Unicode support differs.
OCILIB supports:
OCILIB uses two types of strings:
mtext and dtext are declared as defines around char and wchar_t depending on the charset option
Well, ISO C:
OCILIB uses char/wchar_t strings for public interface and internal storage.
OCILIB, for Unicode builds, initialize OCI in UTF16 Unicode mode. Oracle implements this mode with a 2 bytes (fixed length) UTF16 encoding.
So, on systems implementing wchar_t as 2 bytes based UTF16 (e.g. Ms Windows), input strings are directly passed to Oracle and taken back from it.
On other systems (most of the Unix systems) that use UTF32 as encoding (4 bytes based wchar_t), OCILIB uses:
The buffer expansion is done in place and has the advantage of not requiring extra buffer. That reduces the cost of the Unicode/ISO C handling overhead on Unix systems.
From version 3.6.0, OCILIB fully supports UTF8 strings for all data in OCI_CHARSET_ANSI mode if NLS_LANG environment variable is set to an valid UTF8 Oracle charset string
OCILIB main header file provides macro around most common string functions of the C standard library.
these macros are based on the model:
xxx is the standard C library string function name without the character type prefix (str/wcs).
List of available macros: