Programming Guide |
Executes a transaction command
#include <tmusubs.h>int sm_tm_command(char *cmd_string);
- ·
STATUS
of the current transaction.
- -1 Unable to execute command because transaction is already in progress.
sm_tm_command
executes the specified transaction manager command. Before the command is processed, a test is performed to see if the specified command is available with the current mode.By definition, a command is in progress from the moment
sm_tm_command
is called until the moment it returns. As it processes most commands,sm_tm_command
invokes transaction event functions and transaction models. These, in turn, should not invoke transaction manager commands, because the transaction manager cannot process its commands recursively. This implies that they should not close the active screen (which triggers a FINISH command), or cause any other screen to be displayed that contains table views (which triggers a CHANGE command).For the transaction command START, the command keyword is followed by the transaction name and can also be followed by a table view name.
int sm_tm_command(STARTtransactionName
[
tableViewName
]);
For the transaction command CHANGE, the command keyword is followed by the transaction name.
int sm_tm_command(CHANGEtransactionName
);For other transaction commands, the transaction name is set by the previous START or CHANGE command and the parameter following the command is interpreted as a table view name.
If there is an additional
scope
parameter, it specifies a portion of the table view tree. The command is then applied only to those table views.int sm_tm_command(command
[
tableViewName
][
scope
]);
The
scope
parameter must be preceded by a table view name and takes one of these arguments:
TV_AND_BELOW
- Applies the command to the specified table view and all table views below it on the tree. If no parameter is specified, the transaction manager acts as though
TV_AND_BELOW
was supplied.BELOW_TV
- Applies the command to the table views below the specified table view.
TV_ONLY
- Applies the command to the specified table view only.
SV_ONLY
- Applies the command only to the table views of the specified server view.
Special processing occurs for the FETCH command. For
FETCH
, thescope
parameter is eitherFETCH_SIMPLE
orFETCH_SPECIAL
which specifies the type of fetch processing.
int sm_tm_command("SELECT titles BELOW_TV");
For the syntax of transaction manager commands, refer to Chapter 8, "Transaction Manager Commands."