Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages   Examples  

OCICPP::Connection Class Reference

Encapsulate a connection to a database instance. More...

List of all members.

Public Methods

 Connection ()
 Connection (OCIEnv *env, const string &tnsname, const string &user, const string &password)
 ~Connection ()
void drop ()
void init (OCIEnv *env, const string &tnsname, const string &user, const string &password)
CursorexecQuery (const string &)
void execQuery (const string &,Cursor &,int prefetch=1)
void execUpdate (const string &)
void transStart (int flags=SERIALIZABLE)
void transCommit ()
void transRollback ()
void prepare (const string &sql, Cursor &cur, int prefetch=1)
void getQueue (string &queue_name, OCICPP::AQQueue &queue)
void createBFile (const string &,const string &,BFile &)
void createTLob (int lobtype, int cachemode, TLob &)
string serverVersion ()


Detailed Description

Encapsulate a connection to a database instance.

By creating a connection to a database, a programm can interact with a database instance by the access right associated to the connection.

A connection can be initialized by db::connect()


Constructor & Destructor Documentation

OCICPP::Connection::Connection ( )
 

Default constructor. The connection is not connected to any database instance.

See also:
db::connect()

OCICPP::Connection::Connection ( OCIEnv * env,
const string & tnsname,
const string & user,
const string & password )
 

Create a connection to a database instance describe by tnsname . For authertification user and password are being used. As optional parameter, an Oracle-Environment env may be set for this connection.

See also:
db::connect()

OCICPP::Connection::~Connection ( )
 

Destructor. If a connection has been estabilshed previously, this connection is being erased.


Member Function Documentation

void OCICPP::Connection::createBFile ( const string & dir,
const string & fname,
BFile & bfile )
 

Create new BFile bfile , placed in directory dir with name fname. The directory should be created first on server, and file should exist at his place.

void OCICPP::Connection::createTLob ( int lobtype,
int cachemode,
TLob & tlob )
 

Create a temporary large object (see class TLob) of type lobtype with caching mode cachemode. The temporary LOB structure lob is initialized during this call

Parameters:
lobtype   CLOB and BLOB are supported
cachmode   CACHE_ON or CACHE_OFF is supported
This functions is only available for Oracle 8i and above

void OCICPP::Connection::drop ( )
 

Drop the connection to the database, if a connection had been estabilshed previously.

void OCICPP::Connection::execQuery ( const string & query,
OCICPP::Cursor & cur,
int prefetch = 1 )
 

Execute a query (an SQL-statement) query on the database server. All relevant information are store within the reference cur to a cursor object. prefetch stores, how many rows are to be fetched when executing Cursor::fetch() for the created cursor.

See also:
Cursor *execQuery(const string &)

OCICPP::Cursor * OCICPP::Connection::execQuery ( const string & query )
 

Execute a query (an SQL-Statement) query on the previously initialized database connection. A cursor is returned as a result. The user is responsible for destroying this cursor if it is not required any more.

See also:
void execQuery(const string &,Cursor &,int)

void OCICPP::Connection::execUpdate ( const string & request )
 

Execute an update statement request on the database server. This method can be used to execute UPDATE, INSERT and DELETE SQL statements, which are not returning a cursor.

void OCICPP::Connection::getQueue ( string & queue_name,
OCICPP::AQQueue & queue )
 

Initialize the queue-instance queue to represent the advanced database queue named queue_name.

void OCICPP::Connection::init ( OCIEnv * env,
const string & tnsname,
const string & user,
const string & password )
 

Initialized a connection to the database specified by tnsnames for user user identified by password password . An optional Oracle environment env may be passed to the oracle server.

void OCICPP::Connection::prepare ( const string & sql,
OCICPP::Cursor & cur,
int prefetch = 1 )
 

Prepare and SQL-Statement sql. The cursor cur is accordingly initialized. For fetch-operations, an amount or rows to be prefetched prefetch may be specified.

string OCICPP::Connection::serverVersion ( )
 

Returns the identification string of the Oracle server associated to this connection.

void OCICPP::Connection::transCommit ( )
 

Commit (accept) a previously started transaction. The transaction ends with either being committed or rolled back.

See also:
transStart(), transCommit(), transRollback()

void OCICPP::Connection::transRollback ( )
 

Roll back a previously started transaction. The transaction ends with either being committed or rolled back.

See also:
transStart(), transCommit(), transRollback()

void OCICPP::Connection::transStart ( int flags = SERIALIZABLE )
 

Start a new transaction


The documentation for this class was generated from the following files:
Generated at Tue Jun 12 10:37:29 2001 for OCI C++ Library by doxygen1.2.4-20010128 written by Dimitri van Heesch, © 1997-2001