Returning data to a client

A Server Option application sends text or image data to a client application in one of two ways, depending on the number of columns in the data row.

If there is one text or image column in the row to be sent, the Server Option application proceeds as follows:

  1. Using the TDESCRIB function, the Server Option application describes the format in which the client receives the text or image column.

  2. Optionally you can use the TDSETUDT function to set the user-defined datatype for the text or image column.

  3. The Server Option application invokes the TDINFTXT function with the ACTION parameter set to TDS_SET to indicate the total length of the returning data.

  4. The Server Option application invokes the TDSNDTXT function to send the data to the client in sections.

Table 8 illustrates the sequence of API function calls for sending text or image bulk data to the client.

Table 8: API function call sequence for sending bulk data only

Function

Action performed

TDESCRIB

Describes the text or image column to be sent to the client.

TDSETUDT (optional)

Sets the user-defined datatype for the column.

TDINFTXT (using TDS_SET)

Describes the text or image column to the Server Option. The Server Option application provides values for the CS_IODESC fields before invoking the TDINFTXT function. The TDINFTXT function is invoked once for every row that is to be sent to the client.

TDSNDTXT

Sends a section of the text or image data stream. The TDSNDTXT function is invoked in a loop until all the data for a given row is sent to the client.

TDSNDDON

Notifies the client that all data has been sent.

If there are other columns in addition to the text and image data in the row to be sent, the Server Option application proceeds as follows:

  1. Using the TDESCRIB function, the Server Option application describes the format in which the client receives a column of data. The Server Option application invokes the TDESCRIB function once for each column of data.

  2. The Server Option application invokes the TDINFTXT function with the ACTION parameter set to TDS_SET to provide text pointer and timestamp information. The Server Option application invokes the TDINFTXT function once for each text or image column in a row.

  3. The Server Option application transfers the data to the client application using the TDSNDROW function, which is invoked once for each row of data. The text or image column size must not exceed 32KB.

Table 9 illustrates the sequence of API function calls for sending rows in which there are other columns in addition to the text or image data columns.

Table 9: API function call sequence for sending row data of varied column datatypes

Function

Action performed

TDESCRIB

Describes a column to be sent to the client. The TDESCRIB function is invoked once for each column of data to be sent to the client.

TDINFTXT (using TDS_SET)

Describes a text or image column to the Server Option. The Server Option application provides values for the CS_IODESC fields before invoking the TDINFTXT function. The TDINFTXT function is invoked in two nested loops, once for every text or image column in a row to be sent to the client, and once for every row to be sent to the client.

TDSNDROW

Sends a row of data to the client. The TDSNDROW function is invoked in a loop for every row of data to be sent to the client and preceded by a number of TDINFTXT calls describing the text and image columns in a row.

TDSNDDON

Notifies the client that all data has been sent.