Support for batched parameters

Starting with ESD #4, Open Client and Open Server allow multiple sets of command parameters to be sent without ending the command itself. In an Open Client application, use the new ct_send_params() routine repeatedly to transfer parameters without needing to process the results of the previous command and without needing to resend the command itself. In an Open Server application, set SRV_S_PARAM_BATCHING property to CS_TRUE.


ct_send_params

Description

Send command parameters in batches.

Syntax

CS_RETCODE ct_send_params(
  CS_COMMAND *cmd, 
  CS_INT reserved)

Parameters

Return value

ct_send_params returns:

Returns

Indicates

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Usage

A call to this function sends the parameters indicated earlier using ct_param() or ct_setparam(). To stop sending parameters, use a ct_send() call after the last ct_send_params() call. This signals the end of the parameters and completes the current command.


Rebinding using ct_setparam()

When sending multiple sets of parameters, an application may need to point CT-Library to other locations in memory than for the previous set of parameters. To rebind the parameters, use ct_setparam() to provide a different location for the data. Here is the existing ct_setparam() declaration:

ct_setparam(cmd, datafmt, data, datalenp, indp)

  CS_COMMAND *cmd; 
  CS_DATAFMT *datafmt; 
  CS_VOID *data;
  CS_INT *datalenp; 
  CS_SMALLINT *indp;

Provide new values for data, datalenp and indp parameters in ct_setparam() call to bind to different memory locations.

After a ct_send_params() call, the format of the parameters cannot be changed. Any calls to ct_setparam() made after a call to ct_send_params() must therefore pass a NULL value for datafmt.

Only parameters initially bound with ct_setparam() can be rebound.


Batched parameters support to Server-Library

To enable batched parameter support in Open Server Server-Library, set the SRV_S_PARAM_BATCHING server property to CS_TRUE. For example, before srv_run():

if (srv_props(ctos_ctx->cx_context, CS_SET,
SRV_S_PARAM_BATCHING, (CS_VOID *)&cs_true, sizeof(cs_true), NULL) != CS_SUCCEED)
{...}

Then, srv_xferdata() has two new return codes when a command contains multiple sets of command parameters.


Example programs

Two new CT-Library sample programs are available:

The ctos sample program has been updated to include: