C++ SQL Interface

Overview

CQL++ provides a C++ class interface to the SQL engine. All the ODBC functionality is duplicated in the C++ interface. The C++ interface also provides additional capabilities not supported by ODBC.

The C++ interface is implemented by three classes, SqlHandle, Cursor, and StatementHandle. This chapter describes these classes. All API functions not involved with cursors or prepared statements are member functions of the SqlHandle class. The ISAM interface is implemented by class IsamFile. The index level interface is implemented by class Index. Calls to SqlHandle, Cursor, and StatementHandle member functions can be mixed with calls to IsamFile member functions. The index class should be avoided when using SQL level access.

An application program obtains an SqlHandle object with a call to SqlConnect, which returns a pointer to the handle object. Calls involving cursors use an instance of class Cursor, which is obtained by a call to SqlHandle::DeclareCursor. Calls involving prepared statements use an instance of class StatementHandle, which is obtained by a call to SqlHandle::Prepare.

Programs using the C++ interface need to include header file cqsql.h. This header file provides definitions for classes and constants which are part of the C++ interface. Programs using CQL must link to the SQL library and the ISAM library. For UNIX environments, the library names are cqlsql.a and cqlisam.a. For OS/2 and Windows NT environments, the library names are cqlsql.lib and cqlisam.lib.

A program which makes calls to the SQL engine must obtain an instance of SqlHandle using function SqlConnect. This function is used in both client/server and single user environments. Naturally, no communications connection is necessary in the single user version. The same connection function name is used in both environments, so that application programs can run in either environment.

In client/server environments, SqlConnect establishes the communications link to the server. The server side spawns a process for the connection. This process receives and processes SQL requests until the program calls SqlDisconnect. In single user environments, SqlConnect initializes the library.

To obtain a cursor handle, an application calls SqlHandle::DeclareCursor. The cursor object is valid until it is destroyed by a call to SqlConnect::Close( pCursor ). To close a cursor without destroying it, the application uses Cursor::Close. In strict serializability mode, cursors are automatically destroyed by a call to either CommitTransaction or RollbackTransaction.

An application obtains a statement handle by calling SqlHandle::Prepare. The statement handle is valid until it is destroyed by a call to SqlConnect::Close( pStatementHandle ). The statement handle is prepared for reuse by a call to StatementHandle::Close.

Dynamic Parameters

Statements used with SqlHandle::DeclareCursor and SqlHandle::Prepare can use dynamic parameters. These are represented by the question mark (?) in the SQL statement, and hold a place for a constant which is to be supplied by the program at a later time. For cursors, this is prior to the call to Cursor::Open. For other statements, this is prior to the call to StatementHandle::Execute.

The application supplies dynamic parameter values using function Cursor::SetDynamicParameter or StatementHandle::SetDynamicParameter. It is an error to call either Cursor::Open or StatementHandle::Execute without specifying a value for each dynamic parameter in the associated SQL statement.

Configuration Options

Class SqlConfiguration provides a number of run time configuration switches. This section describes the configuration parameters. Configuration options can be set in two ways. The function SqlInitExtended allows options to be set at connect time. Function GetConfiguration retrieves the current configuration. Function SetConfiguration modifies the configuration. Some parameters can only be specified at Connect time. Changes to these parameters are ignored by a call to SetConfiguration.

Return Codes and Error Reporting

All API functions return one of the following error codes:
CQL_SUCCESS
The function completed successfully
CQL_CHECK_VIOLALTION
The function failed because a column or table CHECK condition was not satisfied
CQL_DUPLICATE_REJECTED
The function failed due to a duplicate error
CQL_FAILURE
The function failed
CQL_INTEGRITY_VIOLATION
The function failed due to a referential integrity error
CQL_NOT_FOUND
The function attempted to locate a row and was unsuccessful
CQL_TRUNCATED
The function completed successfully, but user data for at least one column was truncated
CQL_WAITING
The function is waiting to obtain a lock

When CQL_FAILURE is returned, additional error information is obtained with a call to Error. This function is a member of class Error, which is globally defined.

Additional information may be written to a log file. If the SqlConfiguration::logErrors is set to CQL_YES, error information is written to the log file whenever an error occurs.

Symbolic names and their numeric equivilents are defined in file cqerror.h.

Manual Pages

This section provides manual pages in format similar to UNIX man pages. The following functions are described:
SqlHandle::ActiveTables
SqlHandle::AllocateWorkingSet
StatementHandle::AlterTable
Cursor::Close
StatementHandle::Close
SqlHandle::CommitTransaction
SqlHandle::Connect
StatementHandle::CreateIndex
StatementHandle::CreateTable
StatementHandle::CreateView
Cursor::CursorExpression
Cursor::CursorName
SqlHandle::Cursors
Cursor::CursorStatus
SqlHandle::DeclareCursor
SqlHandle::DisableLocking
SqlHandle::Disconnect
StatementHandle::DropIndex
StatementHandle::DropTable
StatementHandle::DropView
Cursor::DynamicParameters
SqlHandle::Error
SqlHandle::Execute
StatementHandle::Execute
SqlHandle::ExecuteImmediate
Cursor::Fetch
StatementHandle::Fetch
Cursor::GetCurrentPosition
Cursor::GetResultInfo
StatementHandle::Grant
StatementHandle::GrantPrivileges
StatementHandle::GrantUsers
SqlHandle::InitFailed
StatementHandle::InsertColumnNames
Cursor::Open
StatementHandle::InsertWithSelect
StatementHandle::InsertWithValues
SqlHandle::Parse
Cursor::PositionedDelete
Cursor::PositionedUpdate
StatementHandle::PositionedDelete
StatementHandle::PositionedUpdate
SqlHandle::Prepare
SqlHandle::RelaxedLockingEnabled
Cursor::ResultSet
StatementHandle::Revoke
SqlHandle::RollbackTransaction
StatementHandle::SearchedDelete
StatementHandle::SearchedUpdate
StatementHandle::SetCreateBuffer
StatementHandle::SetCreationTable
Cursor::SetCurrentPosition
Cursor::SetCursorExpression
StatementHandle::SetDeleteTtel
StatementHandle::SetDropAts
Cursor::SetDynamicParameter
StatementHandle::SetDynamicParameter
StatementHandle::SetInsertAts
SqlHandle::SetLockingRelaxed
SqlHandle::SetLockingStrict
StatementHandle::SetOldTable
Cursor::Sets
StatementHandle::Sets
Cursor::SetStatus
StatementHandle::SetUpdateTtel
StatementHandle::SetType
VariableSpecification::Setup
SqlHandle::StrictLockingEnabled
SqlHandle::SystemTableColumns
SqlHandle::SystemTableIndices
SqlHandle::SystemTableTables
SqlHandle::TemporaryName
StatementHandle::Type
StatementHandle::UpdateColumns
SqlHandle::UpdateCount
StatementHandle::UpdateCount
StatementHandle::ViewedTableName
StatementHandle::ViewedTablePrefix
SqlHandle::WorkingSets

SqlHandle::ActiveTables

NAME
SqlHandle::ActiveTables
SYNOPSIS
TablenameIndex& ActiveTables( VOID );
DESCRIPTION
ActiveTables returns a handle to a list of currently active tables. It is used during disconnect to close and release memory for tables associated with a connection.
SEE ALSO
  • Disconnect

SqlHandle::AllocateWorkingSet

NAME
SqlHandle::AllocateWorkingSet
SYNOPSIS
NI AllocateWorkingSet( VOID )
DESCRIPTION
AllocateWorkingSet is used to allocate a working set for parsing and processing of an SQL statement. It is generally called by the parser and not by the user.

StatementHandle::AlterTable

NAME
StatementHandle::AlterTable
SYNOPSIS
NI AlterTable( VOID )
DESCRIPTION
AlterTable is called to complete execution of a prepared AlterTable statement.

Cursor::Close

NAME
Cursor::Close
SYNOPSIS
NI Cursor::Close( VOID )
DESCRIPTION
Close closes a cursor but does not destroy it. The cursor can be reopened. Resources associated with the cursor are not released. To close and destroy a cursor, use SqlHandle::Close.
SEE ALSO
  • SqlHandle::DeclareCursor
  • Cursor::Open
  • SqlHandle::Close

StatementHandle::Close

NAME
StatementHandle::Close
SYNOPSIS
NI StatementHandle::Close( VOID )
DESCRIPTION
Close closes a statement but does not destroy it. The statement can be re-executed. Resources associated with the statement are not released. To close and destroy a statement, use SqlHandle::Close.
SEE ALSO
  • SqlHandle::Prepare
  • StatementHandle::Execute
  • StatementHandle::Close
  • SqlHandle::Close

SqlHandle::CommitTransaction

NAME
SqlHandle::CommitTransaction
SYNOPSIS
NI SqlHandle::CommitTransaction( NI followWithBegin = CQL_YES )
DESCRIPTION
CommitTransaction Commits all updates performed during a transaction. Once committed, updates are permanent and cannot be reversed. The followWithBegin argument specifies whether to follow the commit with an immediate BeginTransaction. Ordinarily, when CommitTransaction is called by an application, an immediate BeginTransaction call follows. Internally, a CommitTransaction is often the completion of a nested transaction, and is not followed by a BeginTransaction. For example, for a searched update, an explicit BeginTransaction call occurs. If the searched update completes successfully, CommitTransaction( CQL_NO ) is called to make the elements of the searched update permanent. Because of the explicit BeginTransaction, CommitTransaction is not followed by an automatic call to BeginTransaction.
SEE ALSO
  • SqlHandle::BeginTransaction
  • SqlHandle::RollbackTransaction

SqlHandle::Connect

NAME
SqlHandle::Connect
SYNOPSIS
NI SqlHandle::Connect( pNC name )
DESCRIPTION
Connect is the first function called by an application using CQL++. For client server systems, a connect is established by Connect. In single user systems, no physical connection is made. The Connect function has the same form with both systems, so that the identical application can link to the single user library or the client side library.

Connect requires an SqlHandle object. SqlHandle can be allocated statically or dynamically. The introduction to this chapter describes the use of handles with CQL++.

Connect takes one parameter, which is the user ID. The user ID is an arbitrary identifier. CQL++ does not require that the name be known to the system. A new name is allowed to connect, but will have access only to tables created under this name (or to tables to which PUBLIC access has been granted).

StatementHandle::CreateIndex

NAME
StatementHandle::CreateIndex
SYNOPSIS
NI StatementHandle::CreateIndex( VOID )
DESCRIPTION
CreateIndex executes a prepared CREATE INDEX statement.
SEE ALSO
  • SqlHandle::Prepare

StatementHandle::CreateTable

NAME
StatementHandle::CreateTable
SYNOPSIS
NI StatementHandle::CreateTable( VOID )
DESCRIPTION
CreateTable executes a prepared CREATE TABLE statement.
SEE ALSO
  • SqlHandle::Prepare

StatementHandle::CreateView

NAME
StatementHandle::CreateView
SYNOPSIS
NI StatementHandle::CreateView( VOID )
DESCRIPTION
CreateView executes a prepared CREATE TABLE statement.
SEE ALSO
  • SqlHandle::Prepare

Cursor::CursorExpression

NAME
Cursor::CursorExpression
SYNOPSIS
pQueryExpression CursorExpression( VOID )
DESCRIPTION
Cursor::CursorExpression is used internally to access the expression associated with a cursor. Cursor expressions involve union, intersection, and minus operations on cursors.

Cursor::CursorName

NAME
Cursor::CursorName
SYNOPSIS
String& Cursor::CursorName( VOID )
DESCRIPTION
CursorName returns the current name of a cursor. A cursor does not always have a name. The cursor name is connected to the ODBC functions which set and retrieve a cursor name for a SELECT statement. When a SELECT is prepared, a cursor is created, but the cursor does not have a name. If the ODBC function SQLGetCursorName() is executed, then CQL++ assigns a cursor name to the cursor. If the ODBC function SQLSetCursorName() is executed, then a user specified cursor name is assigned to the cursor.

Cursor names are used for positioned update or delete statements (UPDATE ... WHERE CURRENT OF name or DELETE ... WHERE CURRENT OF name). CursorName is used internally to access the cursor's name during processing of a positioned update or delete statement.

SqlHandle::Cursors

NAME
SqlHandle::Cursors
SYNOPSIS
CursorList& SqlHandle::Cursors( VOID )
DESCRIPTION
Cursors returns a CursorList handle which points to all the open cursors associated with a connection handle. It is used internally to search through the list of active cursors to match a cursor name to a cursor.

Cursor::CursorStatus

NAME
Cursor::CursorStatus
SYNOPSIS
enum Cursor::CursorStatus Status( VOID )
DESCRIPTION
Cursor::Status indicates the status of a cursor at a particular point in time. It is used to determine if various Cursor API calls are permissable at the time they occur. The possible status values are: VIRGIN, CURSOR_OPEN, CLOSED, FETCHING, END_OF_FILE, and BEGINNING_OF_FILE.

SqlHandle::DeclareCursor

NAME
SqlHandle::DeclareCursor
SYNOPSIS
NI SqlHandle::DeclareCursor( pCursor *cursorHandle, pNC selectStatement )
DESCRIPTION
DeclareCursor creates a new cursor. It allocates an instance of class Cursor, and returns its address via parameter cursorHandle. The selectStatement argument provides the SELECT statement for the cursor as a null terminated C string.
SEE ALSO

SqlHandle::DisableLocking

NAME
SqlHandle::DisableLocking
SYNOPSIS
NI SqlHandle::DisableLocking( VOID )
DESCRIPTION
DisableLocking turns locking off for a connection. All cursors associated with the connection, and any future cursors declared for the connection, will not enforce serializability and transaction isolation. While transactions under this connection handle will no longer be safe for multi-user operation, they will still be prevented from invalidating transactions for other connection handles operating in serializability mode.
SEE ALSO
  • SqlHandle::SetLockingStrict
  • SqlHandle::SetLockingRelaxed

SqlHandle::Disconnect

NAME
SqlHandle::Disconnect( VOID )
SYNOPSIS
NI SqlHandle::Disconnect( VOID )
DESCRIPTION
Call this function to release resources and disconnect from the database. Any pending transactions are rolled back, resources are released, and the connection is closed.
ERROR CODES
Any error codes that can be returned by Rollback may be returned by Disconnect.
SEE ALSO
  • SqlHandle::Connect
  • SqlHandle::ConnectExtended

StatementHandle::DropIndex

NAME
StatementHandle::DropIndex
SYNOPSIS
NI SqlHandle::DropIndex( VOID )
DESCRIPTION
DropIndex completes execution of a prepared DROP INDEX statement.
SEE ALSO
SqlHandle::Prepare

StatementHandle::DropTable

NAME
StatementHandle::DropTable
SYNOPSIS
NI SqlHandle::DropTable( VOID )
DESCRIPTION
DropTable completes execution of a prepared DROP INDEX statement.
SEE ALSO
  • SqlHandle::Prepare

StatementHandle::DropView

NAME
StatementHandle::DropView
SYNOPSIS
NI SqlHandle::DropView( VOID )
DESCRIPTION
DropView completes execution of a prepared DROP INDEX statement.
SEE ALSO
  • SqlHandle::Prepare

Cursor::DynamicParameters

NAME
Cursor::DynamicParameters
SYNOPSIS
DynamicParameterElementList& Cursor::DynamicParameters( VOID )
DESCRIPTION
DynamicParameters returns a DynamicParameterElementList class for a cursor. This list describes the dynamic parameters associated with an SQL statement. DynamicParameters is used internally for setting dynamic parameter values prior to execution. The application may also use it to inquire about dynamic parameter details.

SqlHandle::Error

NAME
SqlHandle::Error
SYNOPSIS
NI SqlHandle::Error( ErrorConstants::ErrorCodes *err, pNC errorFile, pNI errorLine, pNI osError )
DESCRIPTION
SqlHandle::Error is used to retrieve error information about an C++ interface function which failed. The function returned some value other than CQL_SUCCESS. SqlHandle::Error is used to retrieve more detailed information about the error. This information is returned through the pointer arguments to the function.

err is a numeric error code value. These values are defined in cqerror.h. errorFile is the name of the file in which the error occurred. errorLine is the line number where the error occurred. osError is the operating system error associated with the error. Frequently, there is no operating system error, and *osError will be 0.

SqlHandle::Execute

NAME
SqlHandle::Execute
SYNOPSIS
NI SqlHandle::Execute( VOID )
DESCRIPTION
SqlHandle::Execute is used to execute a statement previously prepared for execution by a call to SqlHandle::Prepare. SqlHandle::Execute executes the most recently prepared statement, whose identity is saved in SqlHandle class member currentStatement.
SEE ALSO
  • SqlHandle::Prepare

StatementHandle::Execute

NAME
StatementHandle::Execute
SYNOPSIS
NI StatementHandle::Execute( VOID )
DESCRIPTION
StatementHandle::Execute executes a statement previously prepared by a call to SqlHandle::Prepare. The StatementHandle class identifies the statement, which allows multiple prepares to be followed by multiple executes.
SEE ALSO
  • SqlHandle::Prepare

SqlHandle::ExecuteImmediate

NAME
SqlHandle::ExecuteImmediate
SYNOPSIS
NI SqlHandle::ExecuteImmediate( pNC statement )
DESCRIPTION
SqlHandle::ExecuteImmediate executes the supplied SQL statement immediately. If the statement is a SELECT statement, it may return at most one row of data. Use of ExecuteImmediate with a SELECT statement which returns more than one row of data is an error.

Cursor::Fetch

NAME
Cursor::Fetch
SYNOPSIS
NI Cursor::Fetch
(
	UNI numberOfArguments,
	pVariableSpecification v1,
	...
)

NI Cursor::Fetch( VOID )
DESCRIPTION
Fetch returns data for the current row of an open cursor. If there reaches (or is already at) the end of the data, error 100 is returned.

The number of VariableSpecification arguments must match the number of columns in the result set. Each variable specification must contain information which includes the address of space for the column value. Function VariableSpecification::Setup is used to initialize the members of VariableSpecification. After the fetch, the result is available in member data. If the column result value is null (SQL null, not C++ null), member indicator is set to 1, and nothing is written to the space pointed to by data.

If the second flavor of Cursor::Fetch is used (the flavor with no arguments), no data is returned. The status returned by Cursor::Fetch indicates whether any data is available. The application can retrieve the data using Cursor::GetResultInfo.

SEE ALSO
  • SqlHandle::DeclareCursor
  • Cursor::SqldaFetch
  • Cursor::FetchPrevious
  • Cursor::GetResultInfo
  • Cursor::Position
  • Cursor::Close
  • SqlHandle::Close
  • VariableSpecification::Setup

StatementHandle::Fetch

NAME
StatementHandle::Fetch
SYNOPSIS
NI StatementHandle::Fetch
(
	UNI numberOfArguments,
	pVariableSpecification v1,
	...
)
DESCRIPTION
Fetch returns data for a SELECT INTO SQL statement. If no data exists, error 100 is returned. If more than one row exists, Error::TOO_MANY_ROWS is returned.

The number of VariableSpecification arguments must match the number of columns in the result set. Each variable specification must contain information which includes the address of space for the column value. Function VariableSpecification::Setup is used to initialize the members of VariableSpecification. After the fetch, the result is available in member data. If the column result value is null (SQL null, not C++ null), member indicator is set to 1, and nothing is written to the space pointed to by data.

SEE ALSO
  • SqlHandle::Prepare
  • StatementHandle::SqldaFetch
  • StatementHandle::Close
  • SqlHandle::Close
  • VariableSpecification::Setup

Cursor::GetCurrentPosition

NAME
Cursor::GetCurrentPosition
SYNOPSIS
NI Cursor::GetCurrentPosition( pL pos )
DESCRIPTION
Cursor::GetCurrentPosition returns the current result set position as a long integer in *pos. The function fails if there is no current position. The position returned by Cursor::GetCurrentPosition can be used with Cursor::SetCurrentPosition to return to cursor to this point in the result set.
SEE ALSO
  • Cursor::SetCurrentPosition

Cursor::GetResultInfo

NAME
Cursor::GetResultInfo
SYNOPSIS
NI Cursor::GetResultInfo( pUC *data, pUL length, pNI nullFlag, US columnNumber )
DESCRIPTION
Cursor::GetResultInfo is used to retrieve information about a column in the current row of a result set. The function fails if a current position does not exist for the cursor. *data is set to point to the current data for the column. The column length is written to *length. If the column is null, CQL_YES is written to *nullFlag; CQL_NO is written to *nullFlag otherwise. columnNumber specifies the column to return information about.

StatementHandle::Grant

NAME
StatementHandle::Grant
SYNOPSIS
NI StatementHandle::Grant( VOID )
DESCRIPTION
StatementHandle::Grant is used to complete execution of a GRANT statement prepared by a previous call to SqlHandle::Prepare.
SEE ALSO
  • SqlHandle::Prepare

StatementHandle::GrantPrivileges

NAME
StatementHandle::GrantPrivileges
SYNOPSIS
GrantPrivilegeList& StatementHandle::GrantPrivileges( VOID )
DESCRIPTION
StatementHandle::GrantPrivileges returns a GrantPrivilegeList class which lists the privileges associated with an active SQL statement.

StatementHandle::GrantUsers

NAME
StatementHandle::GrantUsers
SYNOPSIS
GrantUserList& StatementHandle::GrantUsers( VOID )
DESCRIPTION
StatementHandle::GrantUsers returns a GrantUserList class which lists the users for whom privileges exist for an active SQL statement.

SqlHandle::InitFailed

NAME
SqlHandle::InitFailed
SYNOPSIS
NI SqlHandle::InitFailed( VOID )
DESCRIPTION
SqlHandle::InitFailed is a flag checked after an SqlHandle is constructed to determine whether an error occured.

StatementHandle::InsertColumnNames

NAME
StatementHandle::InsertColumnNames
SYNOPSIS
InsertColumnNameList& StatementHandle::InsertColumnNames( VOID )
DESCRIPTION
StatementHandle::InsertColumnNames returns an InsertColumnNameList class which lists the insert column names and values associated with an INSERT statement. It is used during PREPARE to copy the insert column values.

Cursor::Open

NAME
Cursor::Open( VOID )
SYNOPSIS
NI Cursor::Open( VOID )
DESCRIPTION
This function opens a cursor. The cursor state must be correct for the open operation. This means that Open must follow SqlHandle::DeclareCursor or Close.

The data associated with a cursor is fetched from the database by the Open call. In multiuser mode, a shared read lock is obtained for each base table row involved in the query. These locks are released when the transaction is committed or rolled back.

SEE ALSO
  • SqlHandle::DeclareCursor
  • Cursor::Fetch
  • Cursor::SqldaFetch
  • Cursor::Close
  • SqlHandle::Close
  • SqlHandle::CommitTransaction
  • SqlHandle::RollbackTransaction

StatementHandle::InsertWithSelect

NAME
StatementHandle::InsertWithSelect
SYNOPSIS
NI StatementHandle::InsertWithSelect( VOID )
DESCRIPTION
StatementHandle::InsertWithSelect completes execution of an INSERT statement previously prepared with SqlHandle::Prepare.
SEE ALSO
  • SqlHandle::Prepare

StatementHandle::InsertWithValues

NAME
StatementHandle::InsertWithValues
SYNOPSIS
NI StatementHandle::InsertWithValues( VOID )
DESCRIPTION
StatementHandle::InsertWithValues completes execution of an INSERT statement previously prepared with SqlHandle::Prepare.
SEE ALSO
  • SqlHandle::Prepare

SqlHandle::Parse

NAME
SqlHandle::Parse
SYNOPSIS
pParser SqlHandle::Parse( VOID )
DESCRIPTION
SqlHandle::Parse accesses the parser which is attached to the SqlHandle class.

Cursor::PositionedDelete

NAME
Cursor::PositionedDelete
SYNOPSIS
NI Cursor::PositionedDelete( String& tableName, String& prefix, NI preparing )
DESCRIPTION
Cursor::PositionedDelete deletes the current row associated with an open cursor. The preparing flag indicates whether the delete should be executed or only prepared.

Cursor::PositionedUpdate

NAME
Cursor::PositionedUpdate
SYNOPSIS
NI Cursor::PositionedUpdate( UpdateColumnNameAndExpList& updateList, NI preparing )
DESCRIPTION
NI Cursor::PositionedUpdate updates the current row associated with an open cursor. The preparing flag indicates whether the update should be executed or only prepared.

StatementHandle::PositionedDelete

NAME
StatementHandle::PositionedDelete
SYNOPSIS
NI StatementHandle::PositionedDelete( VOID )
DESCRIPTION
StatementHandle::PositionedDelete completes execution of a positioned delete previously prepared by a call to SqlHandle::Prepare.
SEE ALSO
  • SqlHandle::Prepare

StatementHandle::PositionedUpdate

NAME
StatementHandle::PositionedUpdate
SYNOPSIS
NI StatementHandle::PositionedUpdate( VOID )
DESCRIPTION
StatementHandle::PositionedUpdate completes execution of a positioned update previously prepared by a call to SqlHandle::Prepare.
SEE ALSO
  • SqlHandle::Prepare

SqlHandle::Prepare

NAME
SqlHandle::Prepare
SYNOPSIS
NI SqlHandle::Prepare
(
	pPreparedStatement *statementHandle,
	pNC statement
)
DESCRIPTION
Prepare is used to prepare a non-select statement for subsequent execution. The combination of functions Prepare and Execute is equivilent to a call to ExecuteImmediate. Prepare is used for statements which are to be executed repeatedly, and also for statements which include dynamic parameters.
SEE ALSO
  • SqlHandle::ExecuteImmediate
  • StatementHandle::Execute

SqlHandle::RelaxedLockingEnabled

NAME
SqlHandle::RelaxedLockingEnabled
SYNOPSIS
NI SqlHandle::RelaxedLockingEnabled( VOID )
DESCRIPTION
SqlHandle::RelaxedLockingEnabled returns CQL_YES if the current locking mode is relaxed. Refer to the Multi-User Access chapter for definitions of locking modes and their affect on serializability.
SEE ALSO
  • SqlHandle::StrictLockingEnabled
  • SqlHandle::DisableLocking

Cursor::ResultSet

NAME
Cursor::ResultSet
SYNOPSIS
pIsamFile Cursor::ResultSet( VOID )
DESCRIPTION
Cursor::ResultSet provides access to the ISAM table which implements the result set for a cursor.

StatementHandle::Revoke

NAME
StatementHandle::Revoke
SYNOPSIS
NI StatementHandle::Revoke( VOID )
DESCRIPTION
StatementHandle::Revoke completes execution of a REVOKE statement previously prepared by the SqlHandle::Prepare statement.
SEE ALSO
  • SqlHandle::Prepare

SqlHandle::RollbackTransaction

NAME
SqlHandle::RollbackTransaction
SYNOPSIS
NI SqlHandle::RollbackTransaction( NI followWithBegin = CQL_NO )
DESCRIPTION
RollbackTransaction reverses all updates performed during a transaction. Once reversed, updates are lost and cannot be performed. The followWithBegin argument specifies whether to follow the rollback with an immediate BeginTransaction. Ordinarily, when RollbackTransaction is called by an application, an immediate BeginTransaction call follows. Internally, a RollbackTransaction is often the completion of a nested transaction, and is not followed by a BeginTransaction. For example, for a searched update, an explicit BeginTransaction call occurs. If the searched update fails, RollbackTransaction( CQL_NO ) is called to reverse the elements of the searched update. Because of the explicit BeginTransaction, RollbackTransaction is not followed by an automatic call to BeginTransaction.
SEE ALSO
  • SqlHandle::BeginTransaction
  • SqlHandle::CommitTransaction

StatementHandle::SearchedDelete

NAME
StatementHandle::SearchedDelete
SYNOPSIS
NI StatementHandle::SearchedDelete( VOID )
DESCRIPTION
StatementHandle::SearchedDelete completes execution of a DELETE statement previously prepared by SqlHandle::Prepare.
SEE ALSO
  • SqlHandle::Prepare

StatementHandle::SearchedUpdate

NAME
StatementHandle::SearchedUpdate
SYNOPSIS
NI StatementHandle::SearchedUpdate( VOID )
DESCRIPTION
StatementHandle::SearchedUpdate completes execution of an UPDATE statement previously prepared by SqlHandle::Prepare.
SEE ALSO
  • SqlHandle::Prepare

StatementHandle::SetCreateBuffer

NAME
StatementHandle::SetCreateBuffer
SYNOPSIS
VOID StatementHandle::SetCreateBuffer( pTempBuffer )
DESCRIPTION
StatementHandle::SetCreateBuffer is used to assign the value of the TempBuffer class associated with a view in the process of being created, when the CREATE VIEW statement is prepared.

StatementHandle::SetCreationTable

NAME
StatementHandle::SetCreationTable
SYNOPSIS
VOID StatementHandle::SetCreationTable( pTableSpecification )
DESCRIPTION
StatementHandle::SetCreationTable is used to assign the value of the TableSpecification class associated with a view or table in the process of being created, when the CREATE TABLE or CREATE VIEW statement is prepared.

Cursor::SetCurrentPosition

NAME
Cursor::SetCurrentPosition
SYNOPSIS
NI Cursor::SetCurrentPosition( L pos )
DESCRIPTION
Cursor::SetCurrentPosition is used to reposition a cursor at some point in the result set. This point is identified by position pos, obtained by a preceding call to Cursor::GetCurrentPosition.
SEE ALSO
  • Cursor::GetCurrentPosition

Cursor::SetCursorExpression

NAME
Cursor::SetCursorExpression
SYNOPSIS
VOID Cursor::SetCursorExpression( pQueryExpression )
DESCRIPTION
Cursor::SetCursorExpression is used to set the QueryExpression associated with a cursor during Parser::DeclareCursor.

StatementHandle::SetDeleteTtel

NAME
StatementHandle::SetDeleteTtel
SYNOPSIS
VOID StatementHandle::SetDeleteTtel( pTableTableElement )
DESCRIPTION
StatementHandle::SetDeleteTtel is used to copy the TableTableElement class for a DELETE statement which is being prepared.

StatementHandle::SetDropAts

NAME
StatementHandle::SetDropAts
SYNOPSIS
VOID StatementHandle::SetDropAts( pAbstractTableSpecification )
DESCRIPTION
StatementHandle::SetDropAts is used to assign the AbstractTableSpecification class for a DROP TABLE statement which is being prepared.

Cursor::SetDynamicParameter

NAME
Cursor::SetDynamicParameter
SYNOPSIS
NI Cursor::SetDynamicParameter( pUC value, UNI parameterNumber, CqlColumnTypes type )
DESCRIPTION
SetDynamicParameter is used to specify the value of a dynamic parameter prior to a call to Cursor::Open. One call is used to set the value of each dynamic parameter. Dynamic parameter values may be set again after the cursor is closed. A value must be specified for each dynamic parameter prior to the first call to Cursor::Open.
SEE ALSO
  • SqlHandle::DeclareCursor
  • Cursor::Open
  • Cursor::Close
  • SqlHandle::Close

StatementHandle::SetDynamicParameter

NAME
StatementHandle::SetDynamicParameter
SYNOPSIS
NI StatementHandle::SetDynamicParameter( pUC, UNI CqlColumnTypes )
DESCRIPTION
StatementHandle::SetDynamicParameter is used to specify the value of a dynamic parameter prior to a call to StatementHandle::Execute or SqlHandle::Execute. One call is used to set the value of each dynamic parameter for the associated SQL statement. A value must be specified for each dynamic parameter prior to the call to StatementHandle::Execute or SqlHandle::Execute.
SEE ALSO
  • SqlHandle::Prepare
  • SqlHandle::Execute
  • StatementHandle::Execute

StatementHandle::SetInsertAts

NAME
StatementHandle::SetInsertAts
SYNOPSIS
VOID StatementHandle::SetInsertAts( pAbstractTableSpecification )
DESCRIPTION
StatementHandle::SetInsertAts is used to assign the value of class AbstractTableSpecification to a StatementHandle member for an INSERT statement which is being prepared.
SEE ALSO
  • SqlHandle::Prepare

SqlHandle::SetLockingRelaxed

NAME
SqlHandle::SetLockingRelaxed
SYNOPSIS
NI SqlHandle::SetLockingRelaxed( VOID )
DESCRIPTION
SqlHandle::SetLockingRelaxed sets the locking mode for SqlHandle to relaxed. Refer to the Multi-User Access chapter for definitions of locking modes and their affect on serializability.
SEE ALSO
  • SqlHandle::DisableLocking
  • SqlHandle::SetLockingStrict

SqlHandle::SetLockingStrict

NAME
SqlHandle::SetLockingStrict
SYNOPSIS
NI SqlHandle::SetLockingStrict( VOID )
DESCRIPTION
SqlHandle::SetLockingStrict sets the locking mode for SqlHandle to strict. Refer to the Multi-User Access chapter for definitions of locking modes and their affect on serializability.
SEE ALSO
  • SqlHandle::DisableLocking
  • SqlHandle::SetLockingRelaxed

StatementHandle::SetOldTable

NAME
StatementHandle::SetOldTable
SYNOPSIS
VOID StatementHandle::SetOldTable( pTableSpecificiation )
DESCRIPTION
StatementHandle::SetOldTable is used to assign the value of class TableSpecification for the old table involved in an ALTER TABLE, CREATE INDEX, or DROP TABLE statement which is being prepared.

Cursor::Sets

NAME
Cursor::Sets
SYNOPSIS
SelectExpressionList& Cursor::Sets( VOID )
DESCRIPTION
Cursor::Sets is used during cursor close processing to cleanup resources associated with the SelectExpression classes associated with an open cursor.

StatementHandle::Sets

NAME
StatementHandle::Sets
SYNOPSIS
SelectExpressionList& StatementHandle::Sets( VOID )
DESCRIPTION
StatementHandle::Sets is used during statement cleanup processing to cleanup resources associated with the SelectExpression classes associated with an executed dynamic statement.

Cursor::SetStatus

NAME
Cursor::SetStatus
SYNOPSIS
VOID Cursor::SetStatus( enum CursorStatus )
DESCRIPTION
Cursor::SetStatus is used to set the status of a cursor. This status may be CURSOR_OPEN, CLOSED, FETCHING, END_OF_FILE, or BEGINNING_OF_FILE. This information is used by various cursor oriented functions to determine whether a particular function call is permissible at the time it occurs.

StatementHandle::SetUpdateTtel

NAME
StatementHandle::SetUpdateTtel
SYNOPSIS
VOID StatementHandle::SetUpdateTtel( pTableTableElement )
DESCRIPTION
StatementHandle::SetUpdateTtel is used to assign the TableTableElement class associated with an UPDATE statement which is being prepared.

StatementHandle::SetType

NAME
StatementHandle::SetType
SYNOPSIS
VOID StatementHandle::SetType( HandleStatementType )
DESCRIPTION
StatementHandle::SetType is used to set a flag in the StatementHandle class which identifies the type of the dynamic SQL statement associated with StatementHandle. The possible values are: ALTER_TABLE, CREATE_INDEX, CREATE_TABLE, CREATE_VIEW, DELETE_POSITIONED, DELETE_SEARCHED, DROP_INDEX, DROP_TABLE, DROP_VIEW, GRANT_STATEMENT, INSERT_VALUES, INSERT_SELECT, REVOKE_STATEMENT, UPDATE_POSITIONED, and UPDATE_SEARCHED.

VariableSpecification::Setup

NAME
VariableSpecification::Setup
SYNOPSIS
NI VariableSpecification::Setup
(
pVOID space,
VariableSpecification::HostType type,
UNI length = 0
)
DESCRIPTION
Setup is used to assign values to an instance of class VariableSpecification. This class is used to describe a host variable into which data is fetched. The first argument is a pointer to the user's variable space. The second argument is a member of the enumeration VariableSpecification::HostType. The third argument is a length. The length argument is required for character and binary types. For types whose length is fixed, the length argument is ignored.

The VariableSpecification::HostType values are:

HOST_SHORT_INTEGER
16 bit signed integer
HOST_LONG_INTEGER
32 bit integer
HOST_FLOAT
32 bit floating point
HOST_DOUBLE
64 bit floating point
HOST_CHAR_ARRAY
An array of characters, usually a string
HOST_CHAR
8 bit signed binary
HOST_DATE
A DateValue structure
HOST_TIME
A TimeValue structure
HOST_TIMESTAMP
A TimestampValue structure
HOST_BINARY
Space for binary data
HOST_DECIMAL
A DecimalValue structure

The structure types are defined in header file cqcolumn.h.

ERROR CODES
If CQL_FAILURE is returned, the following error code values are possible.
ALLOCATION
Unable to allocate memory
SEE ALSO
  • SqlHandle::Fetch

SqlHandle::StrictLockingEnabled

NAME
SqlHandle::StrictLockingEnabled
SYNOPSIS
NI SqlHandle::StrictLockingEnabled( VOID )
DESCRIPTION
SqlHandle::StrictLockingEnabled returns CQL_YES if the current locking mode is strict. Refer to the Multi-User Access chapter for definitions of locking modes and their affect on serializability.

SqlHandle::SystemTableColumns

NAME
SqlHandle::SystemTableColumns
SYNOPSIS
pIsamFile SqlHandle::SystemTableColumns( VOID )
DESCRIPTION
SqlHandle::SystemTableColumns returns the handle of the ISAM system table for column information. It is used during CREATE TABLE, and ALTER TABLE for updating information about a table into the ISAM system table for column information.

SqlHandle::SystemTableIndices

NAME
SqlHandle::SystemTableIndices
SYNOPSIS
pIsamFile SqlHandle::SystemTableIndices( VOID )
DESCRIPTION
SqlHandle::SystemTableIndices returns the handle of the ISAM system table for index information. It is used during CREATE TABLE, ALTER TABLE, CREATE INDEX, and DROP INDEX for updating information about a table in the ISAM system table for index information.

SqlHandle::SystemTableTables

NAME
SqlHandle::SystemTableTables
SYNOPSIS
pIsamFile SqlHandle::SystemTableTables( VOID )
DESCRIPTION
SqlHandle::SystemTableTables returns the handle of the ISAM system table for table information. It is used during CREATE TABLE, ALTER TABLE, CREATE INDEX, DROP INDEX, and DROP TABLE for updating information about a table in the ISAM system table for table information.

SqlHandle::TemporaryName

NAME
SqlHandle::TemporaryName
SYNOPSIS
pNC SqlHandle::TemporaryName( VOID )
DESCRIPTION
SqlHandle::TemporaryName returns a temporary name for use in creating a temporary ISAM table.

StatementHandle::Type

NAME
StatementHandle::Type
SYNOPSIS
HandleStatementType StatementHandle::Type( VOID )
DESCRIPTION
StatementHandle::Type returns the type of the SQL statement associated with StatementHandle. See StatementHandle::SetType for the possible type value.
SEE ALSO
  • StatementHandle::SetType

StatementHandle::UpdateColumns

NAME
StatementHandle::UpdateColumns
SYNOPSIS
UpdateColumnNameAndExpList& StatementHandle::UpdateColumns( VOID )
DESCRIPTION
StatementHandle::UpdateColumns is used to assign the value of class UpdateColumnNameAndExpList to class StatementHandle for an UPDATE statement which is being prepared.
SEE ALSO
  • SqlHandle::Prepare

SqlHandle::UpdateCount

NAME
SqlHandle::UpdateCount
SYNOPSIS
UNI SqlHandle::UpdateCount( VOID )
DESCRIPTION
SqlHandle::UpdateCount returns the number of rows affected by a searched update or searched delete static SQL statement.

StatementHandle::UpdateCount

NAME
StatementHandle::UpdateCount
SYNOPSIS
UNI StatementHandle::UpdateCount( VOID )
DESCRIPTION
StatementHandle::UpdateCount returns the number of rows affected by a searched update or searched delete dynamic SQL statement.

StatementHandle::ViewedTableName

NAME
StatementHandle::ViewedTableName
SYNOPSIS
String& StatementHandle::ViewedTableName( VOID )
DESCRIPTION
StatementHandle::ViewedTableName accesses the name of a VIEW during CREATE VIEW when the statement is being prepared.

StatementHandle::ViewedTablePrefix

NAME
StatementHandle::ViewedTablePrefix
SYNOPSIS
String& StatementHandle::ViewedTablePrefix( VOID )
DESCRIPTION
StatementHandle::ViewedTablePrefix accesses the name of a VIEW during CREATE VIEW when the statement is being prepared.

SqlHandle::WorkingSets

NAME
SqlHandle::WorkingSets
SYNOPSIS
SelectExpressionList& SqlHandle::WorkingSets( VOID )
DESCRIPTION
SqlHandle::WorkingSets is used to copy the parser's working list of SelectExpression classes to a Cursor class or to an StatementHandle class during the prepare process.