Step 1: Prepare the statement

To initiate a command that prepares a dynamic SQL statement, an application calls ct_dynamic with type as CS_PREPARE, id as a character string statement identifier, and buffer as the statement to prepare. For example:

char     *query = “select type, title, price
         from titles
         where title_id = ?”
ct_dynamic(cmd, CS_PREPARE, “myid”, CS_NULLTERM,
     query, CS_NULLTERM);

Statement identifiers must be unique among other dynamic SQL statements prepared on the same connection.

ct_send sends the prepare command to the server, and a standard ct_results loop handles the results.