Programming Guide



dm_dbms

Executes a DBMS command directly from C

#include <dmuproto.h>
int dm_dbms(char *dbms_cmd);

dbms_cmd
Points to a buffer with the DBMS command to execute. Refer to Chapter 11, "DBMS Statements and Commands," for detailed descriptions of each DBMS command.

Returns

Description

dm_dbms lets you execute any DBMS command directly from C. This function executes in the following steps:

  1. dbms_cmd is examined for the WITH ENGINE or WITH CONNECTION clause. If it is not used, dm_dbms assumes the default engine and connection.
  2. The colon preprocessor examines dbms_cmd for colon variables and performs the indicated expansion.
  3. dbms_cmd is passed to the appropriate function for handing DBMS commands. After executing the requested command, Panther updates all global status and error variables (@dm).

If the application has installed an entry function with DBMS ONENTRY, an exit function with DBMS ONEXIT, or an error handler with DBMS ONERROR, the installed function is called for commands executed through dm_dbms.

Example

int start_up ()
{
int retcode;
retcode = dm_dbms ("ONERROR CALL do_error");
if (retcode)
{
sm_emsg("Cannot install application error handler.")
return 0;
}
dm_dbms ("DECLARE c1 CONNECTION FOR USER ':user' PASSWORD
':password'");
return 0;
}

See Also

dm_dbms_noexp