Charset support


Detailed Description

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

Text macro

Option OCI_CHARSET_ANSI

Option OCI_CHARSET_UNICODE

Option OCI_CHARSET_MIXED

Unicode and ISO C
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 unixes) that use UTF32 as encoding (4 bytes based wchar_t), OCILIB uses:

The buffer expansion is done inplace and has the advantage of not requiring extra buffer. That reduces the cost of the Unicode/ISO C handling overhead on Unixes.

Charset mapping macros
OCILIB main header file provides macro around most common string functions of the C standard library.

Theses 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:


Generated on Thu Jul 30 17:41:53 2009 for OCILIB (C Driver for Oracle) by  doxygen 1.5.4