C++ Call Interface Programmer's Guide
ContentsOpens a new window
Opens a new window
Page 21 of 54

OCCI Classes and Methods

Table 13-1Opens a new window provides a brief description of all the OCCI classes. This section is followed by detailed descriptions of each class and its methods.

Table 13-1 Summary of OCCI Classes

Class Description

Agent ClassOpens a new window

Represents an agent in the Advanced Queuing context.

AnyData ClassOpens a new window

Provides methods for the Object Type Translator (OTT) utility, read and write SQL methods for linearization of objects, and conversions to and from other data types.

BatchSQLException ClassOpens a new window

Provides methods for handling batch processing errors; extends the SQLException ClassOpens a new window.

Bfile ClassOpens a new window

Provides access to a SQL BFILE value.

Blob ClassOpens a new window

Provides access to a SQL BLOB value.

Bytes ClassOpens a new window

Examines individual bytes of a sequence for comparing bytes, searching bytes, and extracting bytes.

Clob ClassOpens a new window

Provides access to a SQL CLOB value.

Connection ClassOpens a new window

Represents a connection with a specific database.

ConnectionPool ClassOpens a new window

Represents a connection pool with a specific database.

Consumer ClassOpens a new window

Supports dequeuing of Messages and controls the dequeuing options.

Date ClassOpens a new window

Specifies abstraction for SQL DATE data items. Also provides formatting and parsing operations to support the OCCI escape syntax for date values.

Environment ClassOpens a new window

Provides an OCCI environment to manager memory and other resources of OCCI objects. An OCCI driver manager maps to an OCCI environment handle.

IntervalDS ClassOpens a new window

Represents a time period in terms of days, hours, minutes, and seconds.

IntervalYM ClassOpens a new window

Represents a time period in terms of year and months.

Listener ClassOpens a new window

Listens on behalf of one or more agents on one or more queues.

Map ClassOpens a new window

Used to store the mapping of the SQL structured type to C++ classes.

Message ClassOpens a new window

A unit that is enqueued or dequeued.

MetaData ClassOpens a new window

Used to determine types and properties of columns in a ResultSet, that of existing schema objects in the database, or the database as a whole.

NotifyResult ClassOpens a new window

Used to hold notification information from the Streams AQ callback function.

Number ClassOpens a new window

Models the numeric data type.

PObject ClassOpens a new window

When defining types, enables specification of persistent or transient instances. Class instances derived from PObject can be either persistent or transient. If persistent, a class instance derived from PObject inherits from the PObject class; if transient, there is no inheritance.

Producer ClassOpens a new window

Supports enqueuing options and enqueues Messages.

Ref ClassOpens a new window

The mapping in C++ for the SQL REF value, which is a reference to a SQL structured type value in the database.

RefAny ClassOpens a new window

The mapping in C++ for the SQL REF value, which is a reference to a SQL structured type value in the database.

ResultSet ClassOpens a new window

Provides access to a table of data generated by executing an OCCI Statement.

SQLException ClassOpens a new window

Provides information on database access errors.

StatelessConnectionPool ClassOpens a new window

Represents a pool of stateless, authenticated connections to the database.

Statement ClassOpens a new window

Used for executing SQL statements, including both query statements and insert / update / delete statements.

Stream ClassOpens a new window

Used to provide streamed data (usually of the LONG data type) to a prepared DML statement or stored procedure call.

Subscription ClassOpens a new window

Encapsulates the information and operations necessary for registering a subscriber for notification.

Timestamp ClassOpens a new window

Specifies abstraction for SQL TIMESTAMP data items. Also provides formatting and parsing operations to support the OCCI escape syntax for time stamp values.


Using OCCI Classes

OCCI classes are defined in the oracle::occi namespace. An OCCI class name within the oracle::occi namespace can be referred to in one of three ways:

  • Use the scope resolution operator (::) for each OCCI class name.

  • Use the using declaration for each OCCI class name.

  • Use the using directive for all OCCI class name.

Using Scope Resolution Operator for OCCI

The scope resolution operator (::) is used to explicitly specify the oracle::occi namespace and the OCCI class name. To declare myConnection, a Connection object, using the scope resolution operator, you would use the following syntax:

oracle::occi::Connection myConnection;

Using Declaration in OCCI

The using declaration is used when the OCCI class name can be used in a compilation unit without conflict. To declare the OCCI class name in the oracle::occi namespace, you would use the following syntax:

using oracle::occi::Connection;

Connection now refers to oracle::occi::Connection, and myConnection can be declared as Connection myConnection;.

Using Directive in OCCI

The using directive is used when all OCCI class names can be used in a compilation unit without conflict. To declare all OCCI class names in the oracle::occi namespace, you would use the following syntax:

using oracle::occi;

Then, just as with the using declaration, the following declaration would now refer to the OCCI class Connection as Connection myConnection;.

Using Advanced Queuing in OCCI

The Advanced Queuing classes Producer, Consumer, Message, Agent, Listener, Subscription and NotifyResult are defined in oracle::occi::aq namespace.

OCCI Support for Windows NT and z/OS

When building OCCI application on Windows, a preprocessor definition for WIN32COMMON has to be added.

The following global methods are designed for accessing collections of Refs in ResultSet ClassOpens a new window and Statement ClassOpens a new window on Windows NT and z/OS. While method names changed, the number of parameters and their types remain the same.

  • Use getVectorOfRefs() instead of getVector() on Windows NT and z/OS.

  • Use setVectorOfRefs() instead of setVector() on Windows NT and z/OS.

Applications on Windows NT and z/OS should be calling these new methods only for retrieving and inserting collections of references. Applications not running on Windows NT or z/OS can use either set of accessors. However, Oracle recommends the use of the new methods for any vector operations with Refs.

Working with Collections of Refs

Collections of Refs can be fetched and inserted using methods of the following classes:

ResultSet Class

Fetching Collection of Refs Use the following version of getVectorOfRefs()Opens a new window to return a column of references:

void getVectorOfRefs(
   ResultSet  *rs,
   unsigned int index, 
   vector<Ref<T> > &vect);

Statement Class

Fetching Collection of Refs Use getVectorOfRefs()Opens a new window to return a collection of references from a column:

void getVectorOfRefs(
   Statement  *stmt,
   unsigned int index, 
   vector<Ref<T> > &vect);

Inserting a Collection of Refs Use setVectorOfRefs()Opens a new window to insert a collection of references into a column:

template  <class T>
void setVectorOfRefs(
   Statement *stmt, 
   unsigned int paramIndex,
   const vector<Ref<T> > &vect,
   const string &sqltype);

Inserting a Collection of Refs: Multibyte Support The following method is necessary for multibyte support:

void setVectorOfRefs(
   Statement *stmt,
   unsigned int paramIndex,
   const vector<Ref<T> > &vect,
   const string &schemaName,
   const string &typeName);

Inserting a Collection of Refs: UString (UTF16) Support The following method is necessary for UString support:

template <class T>
void setVectorOfRefs(
   Statement *stmt,
   unsigned int paramIndex,
   const vector<Ref<T> > &vect,
   const UString &schemaName,
   const UString &typeName);