Data types
C API

## Detailed Description

OCILIB implements:

- Oracle Scalar data types through scalar C data types
- Oracle opaque/complex objects though opaque library handles
- Library objects for manipulating the database: connections, transactions, statements...

Supported Oracle data types

- All Database types are supported excluding REFs.

Here is a summary of the supported data types:

- Scalar types CHAR/NCHAR, VARCHAR2/NVARCHAR2, NUMBER, FLOAT, REAL, RAW, ...
- Binary types: RAW, LONG RAW, VARRAW, ..
- Larges Objects (Lobs and Files) : BLOB, CLOB, NCLOB, BFILE
- LONG types: LONG, VAR LONG
- Date, Timestamps et Intervals: DATE, TIMESTAMP, INTERVAL
- PL/SQL types: Ref cursors, PL/SQL Tables
- Named Types (by value): Built-in system objects and User defined objects
- VARRAYs and Nested Tables
- ROWIDs

OCILIB library objects

The public OCILIB library interface implements encapsulation for representing database objects (such as connections, statements ...) through opaque structures (pointers to structures whose definition is kept private)

Instead of directly manipulating the structures and their members, the library has functions to access the underlying members.

It's designed to make the user code as more independent as possible of the library details.

## Typedefs

typedef struct OCI_Pool | OCI_Pool
| Pool object (session or connection) More...
typedef struct OCI_Connection | OCI_Connection
| Oracle physical connection. More...
typedef struct OCI_Statement | OCI_Statement
| Oracle SQL or PL/SQL statement. More...
typedef struct OCI_Bind | OCI_Bind
| Internal bind representation. More...
typedef struct OCI_Resultset | OCI_Resultset
| Collection of output columns from a select statement. More...
typedef struct OCI_Column | OCI_Column
| Oracle SQL Column and Type member representation. More...
typedef struct OCI_Lob | OCI_Lob
| Oracle Internal Large objects: More...
typedef struct OCI_File | OCI_File
| Oracle External Large objects: More...
typedef struct OCI_Transaction | OCI_Transaction
| Oracle Transaction. More...
typedef struct OCI_Long | OCI_Long
| Oracle Long data type. More...
typedef struct OCI_Number | OCI_Number
| Oracle NUMBER representation.
typedef struct OCI_Date | OCI_Date
| Oracle internal date representation.
typedef struct OCI_Timestamp | OCI_Timestamp
| Oracle internal timestamp representation.
typedef struct OCI_Interval | OCI_Interval
| Oracle internal interval representation.
typedef struct OCI_Object | OCI_Object
| Oracle Named types representation.
typedef struct OCI_Coll | OCI_Coll
| Oracle Collections (VARRAYs and Nested Tables) representation.
typedef struct OCI_Elem | OCI_Elem
| Oracle Collection item representation.
typedef struct OCI_Iter | OCI_Iter
| Oracle Collection iterator representation.
typedef struct OCI_Ref | OCI_Ref
| Oracle REF type representation.
typedef struct OCI_TypeInfo | OCI_TypeInfo
| Type info metadata handle. More...
typedef struct OCI_HashTable | OCI_HashTable
| OCILIB implementation of hash tables.
typedef struct OCI_Error | OCI_Error
| Encapsulates an Oracle or OCILIB exception. More...
typedef struct OCI_Mutex | OCI_Mutex
| OCILIB encapsulation of OCI mutexes.
typedef struct OCI_Thread | OCI_Thread
| OCILIB encapsulation of OCI Threads.
typedef struct OCI_DirPath | OCI_DirPath
| OCILIB encapsulation of OCI Direct Path handle.
typedef struct OCI_Subscription | OCI_Subscription
| OCILIB encapsulation of Oracle DCN notification.
typedef struct OCI_Event | OCI_Event
| OCILIB encapsulation of Oracle DCN event.
typedef struct OCI_Msg | OCI_Msg
| OCILIB encapsulation of A/Q message.
typedef struct OCI_Agent | OCI_Agent
| OCILIB encapsulation of A/Q Agent.
typedef struct OCI_Dequeue | OCI_Dequeue
| OCILIB encapsulation of A/Q dequeuing operations.
typedef struct OCI_Enqueue | OCI_Enqueue
| OCILIB encapsulation of A/Q enqueuing operations.
typedef void(* | POCI_ERROR) (OCI_Error *err)
| Error procedure prototype. More...
typedef void(* | POCI_THREAD) (OCI_Thread *thread, void *arg)
| Thread procedure prototype. More...
typedef void(* | POCI_THREADKEYDEST) (void *data)
| Thread key destructor prototype. More...
typedef void(* | POCI_NOTIFY) (OCI_Event *event)
| Database Change Notification User callback prototype. More...
typedef void(* | POCI_NOTIFY_AQ) (OCI_Dequeue *dequeue)
| AQ notification callback prototype. More...
typedef unsigned int(* | POCI_TAF_HANDLER) (OCI_Connection *con, unsigned int type, unsigned int event)
| Failover Notification User callback prototype. More...
typedef void(* | POCI_HA_HANDLER) (OCI_Connection *con, unsigned int source, unsigned int event, OCI_Timestamp *time)
| HA (High Availability) events Notification User callback prototype. More...
typedef struct OCI_XID | OCI_XID
| Global transaction identifier.
typedef union OCI_Variant | OCI_Variant
| Internal Variant type based on union C type. More...
typedef struct OCI_HashValue | OCI_HashValue
| Hash table entry value. More...
typedef struct OCI_HashEntry | OCI_HashEntry
| Hash table entry.
typedef long long | big_int
| big_int is a C scalar integer (32 or 64 bits) depending on compiler support for 64bits integers. big_uint is an unsigned big_int

## Typedef Documentation

## OCI_Pool

OCI_Pool

`#include <ocilib.h>`

Pool object (session or connection)

A pool is a set of pooled objects

Definition at line 406 of file ocilib.h.

## OCI_Connection

OCI_Connection

`#include <ocilib.h>`

Oracle physical connection.

It holds all information about a connection such as error handling, associated statements, ... Error handling and transactions are embedded within a connection object.

Warning
  Multi threaded applications that use multiple connections should use one connection per thread as all statements associated with a connection share the same context.

Definition at line 423 of file ocilib.h.

## OCI_Statement

OCI_Statement

`#include <ocilib.h>`

Oracle SQL or PL/SQL statement.

A Statement object allows users to prepare, execute SQL orders or PL/SQL blocks

Definition at line 435 of file ocilib.h.

## OCI_Bind

OCI_Bind

`#include <ocilib.h>`

Internal bind representation.

A bind object is an object that holds all information about an Oracle statement binding operation

Definition at line 447 of file ocilib.h.

## OCI_Resultset

OCI_Resultset

`#include <ocilib.h>`

Collection of output columns from a select statement.

A resultset object is the result of 'select' SQL Statement.

It's a set of data (ordered in columns) that can be fetched row by row to get data returned by the SQL statement

Definition at line 462 of file ocilib.h.

## OCI_Column

OCI_Column

`#include <ocilib.h>`

Oracle SQL Column and Type member representation.

A column object represents an output column from a select statement

Definition at line 474 of file ocilib.h.

## OCI_Lob

OCI_Lob

`#include <ocilib.h>`

Oracle Internal Large objects:

The following internal Larges Objects are supported:

- BLOBs : Binary large objects
- CLOBs / NCLOBs : Character large objects

LOBs were introduced by OCI8 to replace Long data types.

It's designed to store really larges objects (buffer, files) inside the database

Oracle encourages programmers to use those objects instead of LONG, LONG RAW, ...

OCILIB supports both LOBs and LONGs

Definition at line 497 of file ocilib.h.

## OCI_File

OCI_File

`#include <ocilib.h>`

Oracle External Large objects:

The following external Larges Objects are supported:

- BFILEs : Binary files
- CFILEs : Character files

FILEs were introduced by OCI8 in order to store references to files located outside the database.

Warning
  Only Read-only access is allowed on BFILEs

Two way to use FILEs :

- within statement context (query, binding)
- without statement context (server files reading) through OCI_File properties functions

Definition at line 522 of file ocilib.h.

## OCI_Transaction

OCI_Transaction

`#include <ocilib.h>`

Oracle Transaction.

A transaction can be:

- Local: it's implicitly created by OCILIB
- Global: it's explicitly created by the program

Definition at line 537 of file ocilib.h.

## OCI_Long

OCI_Long

`#include <ocilib.h>`

Oracle Long data type.

The following long Objects are supported:

- LONG RAW : Binary long objects
- LONG : Character long objects

Those types were used in older versions of Oracle (before Oracle8i) to store large chunks of data in the database.

It's now depreciated by Oracle that recommends using LOBs

Many databases and applications are still designed to use LONGs that's why OCILIB supports Long Objects and piecewise operations

Definition at line 559 of file ocilib.h.

## OCI_TypeInfo

OCI_TypeInfo

`#include <ocilib.h>`

Type info metadata handle.

Type info meta data handle.

Definition at line 665 of file ocilib.h.

## OCI_Error

OCI_Error

`#include <ocilib.h>`

Encapsulates an Oracle or OCILIB exception.

The error object is used to raise internal or oracle errors. When an error occurs, if the application has provided an error handler, an error object is constructed and passed to the handler

Definition at line 689 of file ocilib.h.

## POCI_ERROR

POCI_ERROR

`#include <ocilib.h>`

Error procedure prototype.

Parameters

  err | - Error handle

Definition at line 792 of file ocilib.h.

## POCI_THREAD

POCI_THREAD

`#include <ocilib.h>`

Thread procedure prototype.

Parameters

  thread | - Thread handle
  arg | - Pointer passed to OCI_ThreadRun()

Definition at line 808 of file ocilib.h.

## POCI_THREADKEYDEST

POCI_THREADKEYDEST

`#include <ocilib.h>`

Thread key destructor prototype.

Parameters

  data | - Thread Key current pointer value

Definition at line 824 of file ocilib.h.

## POCI_NOTIFY

POCI_NOTIFY

`#include <ocilib.h>`

Database Change Notification User callback prototype.

Parameters

  event | - Event handle

Definition at line 839 of file ocilib.h.

## POCI_NOTIFY_AQ

POCI_NOTIFY_AQ

`#include <ocilib.h>`

AQ notification callback prototype.

Parameters

  dequeue | - dequeue handle

Definition at line 854 of file ocilib.h.

## POCI_TAF_HANDLER

POCI_TAF_HANDLER

`#include <ocilib.h>`

Failover Notification User callback prototype.

Parameters

  con | - Connection handle related to the event
  type | - Event type
  event | - Event code

Note
  Possible values for parameter 'type' :
  - OCI_FOT_NONE
  - OCI_FOT_SESSION
  - OCI_FOT_SELECT
  Possible values for parameter 'event' :
  - OCI_FOE_END
  - OCI_FOE_ABORT
  - OCI_FOE_REAUTH
  - OCI_FOE_BEGIN
  - OCI_FOE_ERROR

Returns
  User callback should return one of the following value :
  - OCI_FOC_OK
  - OCI_FOC_RETRY

Definition at line 890 of file ocilib.h.

## POCI_HA_HANDLER

POCI_HA_HANDLER

`#include <ocilib.h>`

HA (High Availability) events Notification User callback prototype.

Parameters

  con | - Connection handle related to the event
  source | - source of the event
  event | - type of the event
  time | - Timestamp of the event

Note
  Currently, Oracle only send HA down events
  Possible values for parameter 'source' :
  - OCI_HES_INSTANCE
  - OCI_HES_DATABASE
  - OCI_HES_NODE
  - OCI_HES_SERVICE
  - OCI_HES_SERVICE_MEMBER
  - OCI_HES_ASM_INSTANCE
  - OCI_HES_PRECONNECT
  Possible values for parameter 'event' :
  - OCI_HET_DOWN : HA event type down
  - OCI_HET_UP : HA event type up

Definition at line 928 of file ocilib.h.

## OCI_Variant

OCI_Variant

`#include <ocilib.h>`

Internal Variant type based on union C type.

Note
  Helpful for generic buffer, it reduces the amount of casts

## OCI_HashValue

OCI_HashValue

`#include <ocilib.h>`

Hash table entry value.

OCILIB implementation of hash tables uses chaining method for dealing with collisions