ct_dynamic

Description

Initiate a dynamic SQL command.

Syntax

CS_RETCODE ct_dynamic(cmd, type, id, idlen, buffer,
                 buflen)
 
CS_COMMAND   *cmd;
CS_INT                type;
CS_CHAR            *id;
CS_INT                idlen;
CS_CHAR            *buffer;
CS_INT                buflen;

Parameters

cmd

A pointer to the CS_COMMAND structure managing a client/server operation.

type

The type of dynamic SQL command to initiate.Table 3-24 lists the symbolic values for type.

id

A pointer to the statement identifier. This identifier is defined by the application and must conform to server standards.

idlen

The length, in bytes, of *id. If *id is null-terminated, pass idlen as CS_NULLTERM. If id is NULL, pass idlen as CS_UNUSED.

buffer

A pointer to data space.

buflen

The length, in bytes, of *buffer. If *buffer is null-terminated, pass buflen as CS_NULLTERM. If buffer is NULL, pass buflen as CS_UNUSED.

Returns

ct_dynamic returns the following values:

Return value:

Meaning

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

CS_BUSY

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

Usage

Table 3-24 summarizes ct_dynamic usage.

Table 3-24: Summary of ct_dynamic parameters

Value of type

Result

*id is

*buffer is

CS_CURSOR_DECLARE

Declares a cursor on a previously prepared SQL statement.

The prepared statement identifier.

The cursor name.

CS_DEALLOC

Deallocates a prepared SQL statement.

The prepared statement identifier.

NULL

CS_DESCRIBE_INPUT

Retrieves, from the server, a description of the input parameters required to execute a prepared statement. ct_results returns a CS_DESCRIBE_RESULT result_type value when the server has sent the description.

An application can access this information by calling ct_res_info and ct_describe, ct_dynsqlda, or ct_dyndesc.

The prepared statement identifier.

NULL

CS_DESCRIBE_OUTPUT

Retrieves, from the server, a description of the row format of the result set that would be returned if the prepared statement were executed. ct_results returns a CS_DESCRIBE_RESULT result_type value when the server has sent the description.

An application can access this information by calling ct_res_info and ct_describe, ct_dynsqlda, or ct_dyndesc.

The prepared statement identifier.

NULL

CS_EXECUTE

Executes a prepared SQL statement that requires zero or more parameters.

The prepared statement identifier.

NULL

CS_EXEC_IMMEDIATE

Executes a literal SQL statement.

NULL

The SQL statement to execute.

CS_PREPARE

Prepares a SQL statement.

The prepared statement identifier.

The SQL statement to prepare.


Preparing a statement


Declaring a cursor on a prepared statement


Getting a description of prepared statement input


Getting a description of prepared statement output


Executing a prepared statement


Executing a literal statement


Deallocating a prepared statement

See also

ct_dyndesc, ct_dynsqlda, ct_param, ct_setparam, ct_send, ct_cursor