OCILIB (C and C++ Driver for Oracle)  4.6.3
Overview
Introduction
OCILIB++ is a C++ API for Oracle built on top of the C OCILIB API:
  • Full C API ported to C++
  • Implemented as a small set of header files, no library compilation needed
  • Based on C++ and STL paradigms (Strong typing, templates, containers, RAII, exception handling, operators, stack objects)
  • Based on design patterns (RAII, delegation, reference counting, smart pointers, proxies, singleton)
  • No user dynamic object allocation required
  • The only dependences are : STL and OCILIB C API
C++ language requirements
  • The OCILIB C++ API requires only C++03 features.
  • There are no dependencies on recent C++11 norm or C++14 draft.
Reference counting model
  • API usage is very simple, based on stack objects wrapping OCILIB handles using reference counting.
  • OCILIB handles are automatically allocated internally by C++ objects constructors or methods.
  • They are also automatically freed when the last C++ object referencing it goes out of scope.
  • Dynamic memory allocation is not required at all.
  • OCILIB++ allows simple and safe usage of Oracle client without the worries of memory leakages.
  • Using stack objects also makes error handling easier and program logic more robust
C++ API classes usage
Most C++ API classes wrap C API handles. When instances are created using the default constructors, they hold no C handles and have their method IsNull() returning true. Any use of other methods and functions on such object methods will throw an C++ exception. Thus, in order to have a valid object :
  • use a parametrized constructor
  • use the default constructor and then later assign a value to the instance using assignment operator. In the later case, the value can be provided by a function return value or using the object class constructor
Exception model
  • Any failure occurring within an OCILIB C API call will throw a ocilib::Exception
  • For conformance reasons, this class derives from std::Exception
Warning
  • OCILIB++ wraps the whole OCILIB C API.
  • Each C OCILIB object handle has its C++ class counter part.
  • The whole OCILIB C Documentation (concepts, use cases, features and functionalities) is still valid for OCILIB++