Compares widgets in the current table view with their before-image values#include <tmusubs.h>int sm_bi_compare(void);
sm_bi_comparecompares an occurrence value with its before-image and returns a code indicating the status of the comparison. Comparison codes are listed above.
The occurrence is the current occurrence number as determined by sm_tm_inquire
("TM_OCC"). A positive occurrence number indicates an onscreen occurrence. A negative occurrence number indicates a deleted occurrence; an occurrence is deleted by the logical key DELL or by a call to sm_i_doccur.
In the standard transaction models, the requests
sm_bi_compare. This allows the model to choose the appropriate processing for a changed occurrence.
A special case exists when a row's primary key value is set to empty or
NULL. The program can do this in one of the following ways:
In the standard models both the
TM_INSERTrequests test for
BI_KEY_CHANGEDand both perform processing for this change. Therefore, if a primary key value changes, the standard models delete the occurrence using the before-image value of the primary key and insert a new occurrence using the onscreen value of the primary key. The model may be changed so that
TM_UPDATEhandles all updates, including primary key changes.
This function operates on the current table view. It is intended to be called from a transaction model or event function.
/* The following example taken from the standard
transaction model for JDB shows the processing for the
TM_UPDATE request. */case TM_UPDATE:
/* Do nothing, except for updates */
occ_type = sm_bi_compare();
if (occ_type != BI_UPDATED)
save_cursor_type = 0;
reuse_cursor = 0;sm_tm_push_model_event(TM_UPDATE_EXEC);