Sending language commands

A language command defines a batch of one or more SQL statements and sends it to the server to be compiled and executed.

Table 5-5 compares the DB-Library routines used for sending language commands with their Client-Library equivalents:

Table 5-5: DB-Library vs. Client-Library—sending language commands

DB-Library routines

DB-Library functionality

Client-Library routines

Client-Library functionality

(none)

(none)

ct_cmd_alloc(
connection, cmd_pointer)

Allocate a CS_COMMAND structure.

dbfcmd(dbproc, string, args...)

Format text and add to the DBPROCESS command buffer. There is a 1k buffer limit for DB-Library.

sprintf(cmd_string, control_string, args...)

Format text and initialize the language command string using sprintf, strcpy, or other system calls.

dbcmd(dbproc, string)

Add text to the DBPROCESS command buffer.

ct_command(cmd, CS_LANG_CMD, cmd_string, string_len, CS_MORE)

Initiate a language command using cmd_string, with more command text to follow.

(none)

ct_command(cmd, CS_LANG_CMD, cmd_string, string_len, CS_END)

Add cmd_string as the final piece of command text for this command.

dbsqlexec(dbproc)

Send a command batch to the server for execution.

ct_send(cmd)

Send a command batch to the server for execution.