OCILIB (C and C++ Driver for Oracle)  4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
Character sets

Detailed Description

OCILIB supports both ANSI and Unicode.

Oracle started a real Unicode support with Oracle 8i but only for bind and fetch data. All SQL and PL/SQ/ statements, database objects names 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, Unicode support differs.

OCILIB supports:

OCILIB uses the character type 'otext' that is a define around char and wchar_t depending on the charset mode.

Option OCI_CHARSET_ANSI
Option OCI_CHARSET_WIDE
Unicode and ISO C

Well, ISO C:

OCILIB uses char/wchar_t strings for both public interface and internal storage.

Unicode builds of OCILIB initialize OCI in UTF16 Unicode mode. Oracle implements this mode with a 2 bytes (fixed length) UTF16 encoding.

Warning
When using Unicode builds of OCILIB, make sure that the target Database charset is also using an Unicode charset or is a superset of UTF16. If not, strings may be converted with substitution characters by the Oracle client !

So, on systems implementing wchar_t as 2 bytes based UTF16 (e.g. Ms Windows), 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:

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.

UTF8 strings

OCILIB fully supports UTF8 strings :