Programming Guide



sm_tm_inquire

Gets an integer attribute of the current transaction

#include <tmusubs.h>
int sm_tm_inquire(int attribute);

attribute
Specifies the integer attribute of the current transaction to get with one of the constants shown in the Description section.

Returns

Description

sm_tm_inquire gets the value of an integer attribute of the current transaction. This includes the data in the current transaction structure itself and data that can be found indirectly—for example, information about the current table view.

Supply one of the following constants to specify the desired transaction attribute:

TM_AT_OR_BELOW
Traversal specifier.

TM_CANCEL_ON_DISCARD
Gets cursor-related behavior that is associated with the transaction event TM_FINISH. The default setting is 1, which ensures that all cursor-associated locks are released when the FINISH command executes. For behavior that is backward compatible, call sm_iset and supply a value of 0—sm_iset(TM_CANCEL_ON_DISCARD, 0). This change affects all outstanding and subsequent transactions for the current database connection.

TM_CONTINUATION
Value of fetch_directions property for current table view: PV_CONT_DEFAULT, PV_CONT_ALWAYS, PV_CONT_NEVER, PV_CONT_VIEW_ONLY.

TM_CURRENT_COMMAND
Identifies the current transaction event—for example, TM_SELECT during CLOSE processing of a SELECT command.

TM_CURRENT_MODE
Current transaction mode.

TM_CURRENT_OCC
Current occurrence number of current table view.

TM_CURRENT_REQUEST
Current request being processed. Use sm_tm_event_name to get the string equivalent.

TM_EMSG_USED
Error message indicator.

TM_FULL
Full or partial command indicator.

TM_HOOK_IN_USE
Indicates whether a transaction model or transaction event function is in use. Values include:

TM_NOTHING_IN_USE

Nothing in use

TM_MODEL_IN_USE

Transaction model in use

TM_UHOOK_IN_USE

Event function in use

TM_LINK
Link from a table view to its parent table view.

TM_MSG
User specified message code to use for exit condition after a call to sm_tm_command.

TM_OCC
Occurrence number being processed.

TM_OCC_COUNT
The number of occurrences in the table view.

TM_OCC_TYPE
Code reflecting the nature of change, if any, of an occurrence from its before-image. The codes are listed in "Determining How Screen Data Has Changed" on page 36-26 in the Application Development G uide.

TM_PARENT_OCC
Current occurrence of parent of current table view.

TM_PARENTING_OCC
Occurrence that was valid in parent when table view last fetched.

TM_PREVIOUS_EVENT
Indicates the previous transaction manager event. Used when writing an error handler to log the event which generated the error.

TM_PREVIOUS_HOOK_IN_USE
Indicates whether the transaction model or an event function was used in the previous event. Used when writing an error handler. Values include:

TM_NOTHING_IN_USE

Nothing in use

TM_MODEL_PREV_IN_USE

Transaction model used for previous event

TM_UHOOK_PREV_IN_USE

Hook function used for previous event

TM_QUERY_ACTION
Return code from TM_QUERY. Models return:

TM_DISCARD_ACTION

Discard changes

TM_EXIT_ACTION

Return to screen without discarding changes

TM_SAVE_COUNT
When supplied this argument, sm_tm_inquire returns the number of rows that the transaction manager asked the transaction model to save to the database.

Note: The value returned by sm_tm_inquire(TM_SAVE_COUNT) is not equivalent to the number of SQL statements issued, inasmuch as multiple SQL statements can be issued for each row.

If an error occurs during save processing, sm_tm_inquire returns 0 and a DBMS ROLLBACK is executed.

The following example is in smwizard.jpl:

// If new row was added, allow user to work with it.
// Otherwise, place TM back into INITIAL mode.

if (sm_tm_inquire(TM_SAVE_COUNT) > 0)
{
call sm_tm_command("COPY_FOR_UPDATE")
}
else
{
call sm_tm_command("FORCE_CLOSE")
}

TM_STATUS
Error indicator.

TM_SV_SEL_COUNT
For SELECT and VIEW, this argument is set to 1 if the Count Select property indicates that an initial query be performed to determine the number of rows in the select set.

TM_SV_SEL_REQUEST
Request that gave rise to the current select cursor for the table view (either SELECT or VIEW).

TM_USER_VALUE
Reserved for user use.

TM_VALUE, TM_VALUE2
General purpose integer.

TM_XA_TRANSACTION_BEGUN
For the Tuxedo middleware adapter, this argument tests whether the transaction model has started an XA transaction.

See Also

sm_tm_iset, sm_tm_pcopy, sm_tm_pinquire, sm_tm_pset