TDYNAMIC

Description

Reads or responds to a client dynamic SQL command.

Syntax

%INCLUDE SYGWPLI;

01 TDPROC             POINTER,
01 RETCODE            FIXED BIN (31),
01 CMD                FIXED BIN (31),
01 ITEM               FIXED BIN (31),
01 HOST-VARIABLE      CHAR(n),
01 HOST-VAR-LENGTH    FIXED BIN (31),
01 ACTUAL-DATA-LENGTH FIXED BIN (31);
CALL TDYNAMIC (TDPROC, RETCODE, CMD, ITEM, 
	HOST_VARIABLE, HOST_VAR_LENGTH, 
                ACTUAL_DATA_LENGTH);

Parameters

TDPROC

(I) Handle for this client/server connection. This must be the same value specified in the associated TDACCEPT call. The TDPROC handle corresponds to the connection and command handles in Open Client Client-Library.

RETCODE

(O) Variable where the result of function execution is returned. Its value is one of the codes listed in Table 3-46.

CMD

(I) Gets (TDS_GET) or sets (TDS_SET) the value of a particular item.

ITEM

(I/O) Indicates what kind of information is being sent or retrieved.

The valid values are listed in Table 3-45.

Table 3-45: ITEM argument values

Value

Notes

TDS_DYN_TYPE

Legal values for TDS_DYN_TYPE when CMD is TDS_GET: TDS_PREPARE TDS_DESCRIBE_INPUT TDS_DESCRIBE_OUTPUT TDS_EXECUTE TDS_EXEC_IMMEDIATE TDS_DEALLOC

When CMD is TDS_SET, TDS_DYN_ACK is the only valid value.

TDS_DYN_IDLEN

The length of the dynamic statement ID being sent or retrieved.

TDS_DYN_ID

The dynamic statement ID being sent or retrieved.

TDS_DYN_STMTLEN

The length of the dynamic statement being sent or retrieved.

TDS_DYN_STMT

The dynamic statement that is being prepared or executed.

HOST_VARIABLE

(I/O) Buffer in which ITEM value is returned (TDS_GET) or set (TDS_SET).

HOST_VAR_LEN

(I/O) The length in bytes of HOST_VARIABLE. This value varies depending on the value of ITEM. The possible values are:

Value

Notes

TDS_DLYN_TYPE (4)

TDS_DYN_IDLEN (4)

TDS_DYN_ID

Depends on the size of ID (maximum is 255)

TDS_DYN_STMTLEN (4)

TDS_DYN_STMT

Depends on the size of dynamic statement

Returns

The RETCODE argument can contain any of the return values listed in Table 3-46.

Table 3-46: TDYNAMIC return values

Return value

Meaning

TDS_DYNSQL_ALREADY_DEALLOCATED (-84)

Dynamic SQL request already allocated. You cannot deallocate a dynamic SQL request that is already allocated.

TDS_DYNSQL_ALREADY_PREPARED (-81)

Dynamic SQL request already prepared. You cannot prepare a dynamic SQL request that is already deallocated.

TDS_DYNSQL_ID_NOT_FOUND (-85)

Dynamic SQL request not found.

TDS_DYNSQL_IDLEN_TOO_LONG (-87)

Dynamic SQL request ID length is greater than 255.

TDS_DYNSQL_NO_STMT_GIVEN (-86)

No SQL statement is associated with the dynamic SQL request.

TDS_DYNSQL_NOT_PREPARED (-80)

A dynamic SQL request is not prepared.

TDS_DYNSQL_OUTPUT_ALREADY_DEFINED (-83)

Dynamic SQL output already defined. You cannot define dynamic SQL output more than once.

TDS_DYNSQL_PARMS_ALREADY_DEFINED (-82)

Dynamic SQL parameters already defined. You cannot define dynamic SQL parameters more than once.

TDS_DYNSQL_STMT_NOT_FOUND (-89)

No SQL statement is associated with the dynamic SQL request.

TDS_INVALID_BOOLEAN (-180)

Invalid Boolean value. Boolean values must be set to either CS_TRUE or CS_FALSE.

TDS_INVALID_CURCLOSOPTION (-182)

A “closed” cursor command specified an invalid option. The Gateway-Library transaction received a “closed” cursor command, but the value of the OPTION field of the CURSOR_DESC structure is invalid. Valid options are TDS_CUR_UNUSED and TDS_CUR_DEALLOC.

TDS_INVALID_CURDECLOPTION (-183)

A declare cursor command has an invalid option specified. The Gateway-Library transaction received a declare cursor command, but the value of the OPTION field of the CURSOR_DESC structure is invalid. Valid options are TDS_CUR_UNUSED and TDS_CUR_DEALLOC.

TDS_INVALID_CURDECLSTAT (-184)

Illegal cursor declare option.

TDS_INVALID_CURINFCMD (-195)

Illegal cursor information command.

TDS_INVALID_CUROPENSTAT (-187)

Illegal cursor open status.

TDS_INVALID_CURUPDSTAT (-186)

Illegal cursor update status.

TDS_INVALID_DATA_CONVERSION (-172)

Incompatible datatypes. The source datatype cannot be converted into the requested result datatype.

TDS_INVALID_DATA_TYPE (-171)

Illegal datatype. A Sybase datatype supplied in the call is not supported and the conversion cannot be done. The operation failed.

TDS_INVALID_DATAFMT_VALUE (-181)

One or more values specified for fields in the DATAFMT structure are illegal.

TDS_INVALID_DYNSQL_FSM (-79)

Dynamic SQL request in invalid state.

TDS_INVALID_DYNSTAT (-188)

Invalid status for dynamic SQL request.

TDS_INVALID_DYNTYPE (-189)

Invalid type for dynamic SQL request.

TDS_INVALID_FLAGS (-176)

Invalid padding option for a field.

TDS_INVALID_LENGTH (-173)

Wrong length. The length specified in the HOST_VAR_LEN argument is too long.

TDS_INVALID_NAMELENGTH (-179)

Invalid name length. The length specified for the column, parameter, message, or server name is invalid.

TDS_INVALID_PRECISION (-177)

Invalid precision value. The precision value specified during conversion of TDS_PACKED_DECIMAL data is invalid.

TDS_INVALID_SCALE (-178)

Invalid scale value. The scale value specified during conversion of TDS_PACKED_DECIMAL data is invalid.

TDS_INVALID_STATUS (-174)

Invalid status value. The value entered in the STATUS field is invalid.

TDS_INVALID_VAR_ADDRESS (-175)

Specified variable address is invalid. No variable with the specified name exists. A NULL value was specified. The operation failed.