cs_diag

Description

Manages inline error handling.

Syntax

CS_RETCODE cs_diag(context, operation, type, index,
              buffer)
 
 CS_CONTEXT   *context;
 CS_INT              operation;
 CS_INT              type;
 CS_INT              index;
 CS_VOID            *buffer;

Parameters

context

A pointer to a CS_CONTEXT structure.

operation

The operation to perform. Table 2-5 lists the legal symbolic values for operation.

type

Depending on the value of operation, type indicates either the type of structure to receive message information or the type of message on which to operate, or both.

Possible values are:

Value of type

Indicates

SQLCA_TYPE

A SQLCA structure.

SQLCODE_TYPE

A SQLCODE structure, which is a long integer.

SQLSTATE_TYPE

A SQLSTATE structure, which is a 6-element character array.

CS_CLIENTMSG_TYPE

A CS_CLIENTMSG structure. Also used to indicate CS-Library messages.

index

The index of the message of interest. The first message has an index of 1, the second an index of 2, and so forth.

buffer

A pointer to data space.

Depending on the value of operation, buffer can point to a structure or a CS_INT.

Returns

cs_diag returns:

Returns

Indicates

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

CS_NOMSG

The application attempted to retrieve a message whose index is higher than the highest valid index. For example, the application attempted to retrieve message number 3 but only 2 messages were available.

Common reasons for a cs_diag failure include:

Usage

Table 2-5: Summary of cs_diag parameter usage

Value of operation

cs_diag

type is

index is

buffer is

CS_INIT

Initializes inline error handling.

CS_UNUSED

CS_UNUSED

NULL

CS_MSGLIMIT

Sets the maximum number of messages to store.

CS_CLIENTMSG_ TYPE

CS_UNUSED

A pointer to an integer value.

CS_CLEAR

Clears message information for this context.

If buffer is not NULL, cs_diag also clears the *buffer structure by initializing it with blanks and/or NULLs, as appropriate.

One of the legal type values.

CS_UNUSED

A pointer to a structure whose type is defined by type, or NULL.

CS_GET

Retrieves a specific message.

One of the legal type values.

The one-based index of the message to retrieve.

A pointer to a structure whose type is defined by type.

CS_STATUS

Returns the current number of stored messages.

CS_CLIENTMSG_ TYPE

CS_UNUSED

A pointer to an integer value.


Initializing inline error handling


Clearing messages


Retrieving messages


Limiting messages


Retrieving the number of messages

See also

ct_callback, ct_options