Fields in a CURSOR_DESC structure

Table 2-5 describes each field in a CURSOR_DESC structure.

Table 2-5: Fields in a CURSOR_DESC structure

Field name

Description

Notes

CURSOR_ID

The current cursor identifier.

The Open ServerConnect application must set CURSOR_ID when responding to a TDS_CURSOR_DECLARE (DECLARE CURSOR) command from the client. This happens when the client sends a DECLARE CURSOR command that has CURSOR-NAME as a required parameter.

The Gateway-Library transaction receives the DECLARE CURSOR command from the client, calls TDCURPRO to specify a unique cursor identifier in the CURSOR_ID field, and returns the unique cursor ID to the client.

The client uses the unique cursor ID (instead of the initial cursor name) in the CURSOR_ID field of the CURSOR_DESC structure for all subsequent commands regarding this cursor.

NUMBER_OF_ UPDATE_ COLUMNS

The number of columns in a cursor update clause.

NUMBER_OF_UPDATE_COLUMNS is set to 0 if there are no update columns. This information is available at declare time.

FETCH_COUNT

The current row fetch count for this cursor (the number of rows that are sent to the client in response to a TDS_CURSOR_ FETCH command).

FETCH_COUNT is described when a TDS_CURSOR_INFO command is received from the client, or sent to the client in response to such a command. FETCH_COUNT is set to 1 if the client has not explicitly set a row fetch count. If the Open ServerConnect application cannot support the requested fetch count, it can set this field to a different value before responding.

CURSOR_STATUS

The status of the current cursor.

Open ServerConnect sets the cursor status in response to the cursor command received from the client. See Table 2-6 for a list of legal values.

CURSOR_ COMMAND

The current cursor command type.

See Table 2-7 for a list of legal values.

COMMAND_ OPTIONS

Any options associated with the cursor command.

Not all commands have associated options. The value of COMMAND_OPTIONS depends on the cursor command. Table 2-7 describes the possible values for COMMAND_OPTIONS.

FETCH_TYPE

The type of fetch requested by a client.

FETCH_TYPE is described when a TDS_CURSOR_FETCH command is received from the client. The valid fetch types and their meanings are as follows: - TDS_NEXT – next row - TDS_PREV – previous row - TDS_FIRST – first row - TDS_LAST – last row - TDS_ABSOLUTE – row identified in the ROW_OFFSET field - TDS_RELATIVE – current row plus or minus the value in the ROW_OFFSET field Requests to Open ServerConnect always have a FETCH_TYPE of TDS_NEXT.

ROW_OFFSET

The row position for TDS_ABSOLUTE or TDS_RELATIVE fetches.

ROW_OFFSET is undefined for all other fetch types. ROW_OFFSET is described when a TDS_CURSOR_FETCH command is received from the client.

CURSOR_NAME_ LENGTH

The length of the cursor name in CURSOR_NAME.

CURSOR_NAME_LENGTH is zero if not used. If used, CURSOR_NAME_LENGTH is the actual length.

CURSOR_NAME

The name of the current cursor.

TABLE_NAME_ LENGTH

The length of the table name in TABLE_NAME.

TABLE_NAME_LENGTH is zero if not used. If used, TABLE_NAME_LENGTH is the actual length. TABLE_NAME_LENGTH is described when a TDS_CURSOR_UPDATE or TDS_CURSOR_DELETE command is received from the client.

TABLE_NAME

The table name associated with a cursor update or delete command.

TABLE_NAME is described when a TDS_CURSOR_UPDATE or TDS_CURSOR_DELETE command is received from the client.