Skip Headers
Oracle® C++ Call Interface Programmer's Guide
10g Release 2 (10.2)

Part Number B14294-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

OCCI Classes and Methods

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

Table 12-1 Summary of OCCI Classes

Class Description
Agent Class
Represents an agent in the Advanced Queuing context.
AnyData Class
Provides methods for the Object Type Translator (OTT) utility, read and write SQL methods for linearization of objects, and conversions to and from other datatypes.
BatchSQLException Class
Provides methods for handling batch processing errors; extends the SQLException Class.
BfileClass
Provides access to a SQL BFILE value.
Blob Class
Provides access to a SQL BLOB value.
Bytes Class
Examines individual bytes of a sequence for comparing bytes, searching bytes, and extracting bytes.
Clob Class
Provides access to a SQL CLOB value.
Connection Class
Represents a connection with a specific database.
ConnectionPool Class
Represents a connection pool with a specific database.
Consumer Class
Supports dequeuing of Messages and controls the dequeuing options.
Date Class
Specifies abstraction for SQL DATE data items. Also provides formatting and parsing operations to support the OCCI escape syntax for date values.
Environment Class
Provides an OCCI environment to manager memory and other resources of OCCI objects. An OCCI driver manager maps to an OCCI environment handle.
IntervalDSClass
Represents a period of time in terms of days, hours, minutes, and seconds.
IntervalYMClass
Represents a period of time in terms of year and months.
Listener Class
Listens on behalf of one or more agents on one or more queues.
Map Class
Used to store the mapping of the SQL structured type to C++ classes.
Message Class
A unit that is enqueued or dequeued.
MetaDataClass
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 Class
Used to hold notification information from the Streams AQ callback function.
Number Class
Models the numerical datatype.
PObject Class
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 Class
Supports enqueuing options and enqueues Messages.
Ref Class
The mapping in C++ for the SQL REF value, which is a reference to a SQL structured type value in the database.
RefAnyClass
The mapping in C++ for the SQL REF value, which is a reference to a SQL structured type value in the database.
ResultSet Class
Provides access to a table of data generated by executing an OCCI Statement.
SQLException Class
Provides information on database access errors.
StatelessConnectionPool Class
Represents a pool of stateless, authenticated connections to the database.
Statement Class
Used for executing SQL statements, including both query statements and insert / update / delete statements.
StreamClass
Used to provide streamed data (usually of the LONG datatype) to a prepared DML statement or stored procedure call.
Subscription Class
Encapsulates the information and operations necessary for registering a subscriber for notification.
Timestamp Class
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:

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

The following global methods are designed for accessing collections of Refs in ResultSet Class and Statement Class on Windows NT. While method names changed, the number of parameters and their types remain the same.

Applications on Windows NT should be calling these new methods only for retrieving and inserting collections of references. Applications not running on Windows NT 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() 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() 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() 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 should be used 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 should be used for UString support:

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

Working with Collections of Objects

The global methods for the fetching or inserting of collections of objects have been changed for Windows NT. The interface remains the same with respect to the method names and the number of parameters and the datatypes, but differs in the template parameter definition for Windows NT. Specifically, the template parameter for the template methods of getVector() and setVector() of objects (object pointers) on Windows NT have a T instead of a T* as shown in the following APIs.

The methods are used in the same way on different operating systems, and you don't need to modify the call to these methods. On Windows NT, the template arguments passed as object pointers in the method call are specialized for parameter T, instead of a T* on other operating systems.

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

ResultSet Class

Fetching a Collection of objects This method fetches a collection of objects from a ResultSet for the column specified by the index.

#ifdef WIN32COMMON
   template <class T>
   void getVector( ResultSet *rs, unsigned int index, 
     vector< T > &vect);
#else
  template <class T>
    void getVector( ResultSet *rs, unsigned int index,
      vector< T* > &vect);
#endif

Statement Class

Fetching a Collection of Objects This method fetches a collection of objects from a statement for the column specified by the index. This method is used in case of OUT binds.

#ifdef WIN32COMMON
   template <class T>
   void getVector( Statement *stmt, unsigned int index,  
     vector< T > &vect);
  #else
   template <class T>
   void getVector( Statement *stmt, unsigned int index,
     vector< T* > &vect);
  #endif

Inserting a Vector of Objects This method inserts a collection of objects into a statement for the column specified by the index.

#ifdef WIN32COMMON
  template <class T>
  void setVector( Statement *stmt, unsigned int paramIndex, 
    const vector< T > &vect, 
    const  string &sqltype);
#else
  template <class T>
  void setVector( Statement *stmt, unsigned int paramIndex,
    const vector<T* > &vect, 
    const string &sqltype);
#endif

Inserting a Vector of Objects: Multibyte Support The following method should be used for multibyte support:

#ifdef WIN32COMMON
template <class T>
void setVector(
   Statement *stmt,
   unsigned int paramIndex,
   const vector< T > &vect,
   const string &schemaName,
   const string &typeName);
#else
template <class T>
void setVector(
   Statement *stmt,
   unsigned int paramIndex,
   const vector< T*> &vect,
   const string &schemaName,
   const string &typeName);
#endif

Inserting a Collection of Objects: UString (UTF16) Support The following method should be used for UString support:

#ifdef WIN32COMMON
template <class T>
void setVector(
   Statement *stmt,
   unsigned int paramIndex,
   const vector< T > &vect,
   const UString &schemaName,
   const UString &typeName);
#else
template <class T>
void setVector(
   Statement *stmt,
   unsigned int paramIndex,
   const vector< T*> &vect,
   const UString &schemaName,
   const USring &typeName);
#endif