To initiate a command to execute the prepared statement, the application calls ct_dynamic with type as CS_EXECUTE and id as the statement identifier. The application must define any parameters required to execute the prepared statement. Parameter values can be defined in one of several ways:
By calling ct_param once for each parameter. ct_param and ct_setparam offer the best performance. ct_param does not allow the application to change parameter values before resending the command.
By calling ct_setparam once for each parameter. ct_setparam takes pointers to parameter source values. This method is the only one that allows parameter values to be changed before resending the command.
By calling ct_dyndesc several times to allocate a dynamic descriptor area, populate it with data values, and apply it to the command. ct_dyndesc(CS_USE_DESC) calls ct_param internally.
By calling ct_dynsqlda to apply the contents of a user-allocated SQLDA structure to the command. Note that ct_dynsqlda(CS_SQLDA_PARAM) calls ct_param internally.
The application can determine the number and format of a prepared statement’s parameters by sending a describe-input command and handling the results before executing the prepared statement. See “Step 2: Get a description of command inputs”.
ct_send sends the command to the server, and a standard ct_results loop handles the results. Code your application to handle the results with a standard results loop, as discussed in “Structure of the basic loop”.