Page 11 out of 26 total pages


QbConnectClass


QbConnectClass is derived from the QbBaseClass and is used to obtain a connection to a database or a file system. The Connect method establishes a connection to a database, or mounts a filesystem (processing that is expensive and typically only done once). The Disconnect method disconnects from the database, or dismounts the file system.

The function QbGetConnection in the file QbCreate.cpp implements the simple one-connection-per-address-space connection needed by the current QBIC implementation, which uses the Berkeley dbm system. QbGetConnection takes two arguments:

QbConnectClass method

This is the constructor for the class.

Syntax

QbConnectClass( void )

Parameters

None

~QbConnectClass method

This is the destructor for the class.

Syntax

virtual ~QbConnectClass( void )

Parameters

None

Connect method

This method connects to the named database in either read or write mode.

Syntax

virtual int Connect( const char *dsNameArg, const char *modeArg )

Parameters

Input

Output

An integer value: 0 indicates success; -1 indicates failure

CreateCatalogClass method

This method provides an abstract architected method to create a catalog class.

Syntax

virtual QbCatalogClass * CreateCatalogClass( void )

Parameters

Input

None

Output

A pointer to a QbCatalogClass object

CreateDatabaseClass method

This method provides an abstract architected method to create a database class to support database operations such as Open, Close, Insert, Delete, Update, and so on.

Syntax

virtual QbDatabaseClass * CreateDatabaseClass( void )

Parameters

Input

None

Output

A pointer to a QbDatabaseClass object

CreateKeyDatabaseClass method

This method provides an abstract architected method to create a key database class for storing query results and for specifying the restriction list in a query.

Syntax

virtual QbKeyDatabaseClass * CreateKeyDatabaseClass( void )

Parameters

Input

None

Output

A pointer to a QbKeyDatabaseClass object

Disconnect method

This method disconnects from the database.

Syntax

virtual int Disconnect( void )

Parameters

Input

None

Output

An integer value: 0 indicates success; -1 indicates failure

GetConnectMode method

This method returns the database connection mode: either "r" or "w" for read or write.

Syntax

virtual const char * GetConnectMode( void )

Parameters

Input

None

Output

A pointer to a char that contains either "r" or "w" for read or write

GetDSName method

This method returns the name of the database to which the current object is connected.

Syntax

virtual const char * GetDSName( void )

Parameters

Input

None

Output

A pointer to a string that contains the database name

IsConnected method

This method returns True if the database is connected already, and False if it is not.

Syntax

virtual Boolean IsConnected( void )

Parameters

Input

None

Output

A Boolean value; True if connected, False it not





Page 11 out of 26 total pages


xzhu@almaden.ibm.com or tedl@almaden.ibm.com
Copyright © 1998, IBM Corporation. All rights reserved.