ct_dyndesc

Description

Perform operations on a dynamic SQL descriptor area.

Syntax

CS_RETCODE ct_dyndesc(cmd, descriptor, desclen, operation, index,
                                             datafmt, buffer, buflen, copied, indicator)
 
CS_COMMAND       *cmd;
CS_CHAR                *descriptor;
CS_INT                    desclen;
CS_INT                    operation;
CS_INT                    index;
CS_DATAFMT         *datafmt;
CS_VOID                *buffer;
CS_INT                   buflen;
CS_INT                   *copied;
CS_SMALLINT       *indicator;

Parameters

cmd

A pointer to a CS_COMMAND structure. Any CS_COMMAND in the same context in which a descriptor is allocated can be used to operate on the descriptor.

descriptor

A pointer to the name of the descriptor. Descriptor names must be unique within a context.

desclen

The length, in bytes, of *descriptor. If *descriptor is null-terminated, pass desclen as CS_NULLTERM.

operation

The descriptor operation to initiate. The following table lists the values for operation:

Table 3-25: Values for ct_dyndesc operation parameter

Value of operation

Result

CS_ALLOC

Allocates a descriptor.

CS_DEALLOC

Deallocates a descriptor.

CS_GETATTR

Retrieves a parameter or result item’s attributes.

CS_GETCNT

Retrieves the number of parameters or columns.

CS_SETATTR

Sets a parameter’s attributes.

CS_SETCNT

Sets the number of parameters or columns.

CS_USE_DESC

Associates a descriptor with a statement or a command structure.

index

When used, an integer variable.

Depending on the value of operation, index can be either the 1-based index of a descriptor item or the number of items associated with a descriptor.

datafmt

When used, a pointer to a CS_DATAFMT structure.

buffer

When used, a pointer to data space.

buflen

When used, buflen is the length, in bytes, of the *buffer data.

copied

When used, a pointer to an integer variable. ct_dyndesc sets *copied to the length, in bytes, of the data placed in *buffer.

indicator

When used, a pointer to an indicator variable.

Table 3-26: Values for ct_dyndesc indicator parameter

Value of operation

Value of *indicator

Meaning

CS_GETATTR

-1

Truncation of a server value by Client-Library.

0

No truncation.

integer value

Truncation of an application value by the server.

CS_SETATTR

-1

The parameter has a null value.

Returns

ct_dyndesc returns the following values:

Return value

Meaning

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

CS_ROW_FAIL

A recoverable error occurred. Recoverable errors include conversion errors that occur while copying values to program variables as well as memory allocation failures.

CS_BUSY

An asynchronous operation is already pending for this connection. See “Asynchronous programming”.

Usage


Allocating a descriptor


Deallocating a descriptor


Retrieving a parameter or result item’s attributes


Retrieving the number of parameters or columns


Setting a parameter’s attributes


Setting the number of parameters or columns


Associating a descriptor with a statement or command structure


Getting descriptions of command inputs or outputs with ct_dyndesc


Passing parameter values with ct_dyndesc


Retrieving result column values with ct_dyndesc

See also

ct_bind, ct_cursor, ct_describe, ct_dynamic, ct_dynsqlda, ct_fetch, ct_param