This is an old revision of the document!
RTI_SUPPRESS_INDEX_TRANSACTIONS Function
This routine is not currently available - it will be fully enabled for OpenInsight 10.3
Description
The RTI_SUPPRESS_INDEX_TRANSACTIONS function temporarily disables, or re-enables, index updates on the specified table. This may make batch updating of the table more performant.
Syntax
previousFlag = RTI_SUPPRESS_INDEX_TRANSACTIONS(tableName,flag)
Parameters
The RTI_SUPPRESS_INDEX_TRANSACTIONS function has the following parameters:
Parameter | Description |
---|---|
tableName | The name of an indexed table whose index you wish to suppress or reset |
flag | "1" to suppress the index on the specified table, or "0" to re-enable the index |
Return Result
RTI_SUPPRESS_INDEX_TRANSACTIONS returns the previous state of the "suppress" flag for the specified table.
See Also
Using RTI_SUPPRESS_INDEX_TRANSACTIONS
Normally, when the system writes a data record to an indexed table, it must also write a transaction record to the "!" table associated with the indexed table. You can make this process somewhat more efficient by temporarily suspending the index update process for specific table(s) using RTI_SUPPRESS_INDEX_TRANSACTIONS.
Once the batch updating of table records is complete, you should re-enable index transactions by calling RTI_SUPPRESS_INDEX_TRANSACTIONS for the table, this time passing in "0" for flag. You should also call UPDATE_INDEX to update the indices.
Example
/* The following code opens a file, turns on the index suppression, writes records to the opened file, then turns off the index suppression. NOTE: after re-enabling the index process, you should update the indices to restore them to their proper state. The internal subroutines included here are dummies, which in practice would be replaced by proper record processing routines. */ SUBROUTINE BATCH_UPDATE_TABLE(VOID) DECLARE FUNCTION RTI_SUPPRESS_INDEX_TRANSACTIONS EQU start_suppress$ TO 1 EQU stop_suppress$ TO 0 file = "SAMPLE_CUSTOMERS" done = 0 prevState = RTI_SUPPRESS_INDEX_TRANSACTIONS(file, start_suppress$) OPEN file TO filevar THEN SELECT filevar LOOP GOSUB build_records UNTIL done GOSUB write_records REPEAT END dummy = RTI_SUPPRESS_INDEX_TRANSACTIONS(file, prevState) ;* re-enable if previously enabled if prevState = "0" then * indices are no longer suppressed on this table; update them call Update_Index(file, '', '') END RETURN 0 ******************** Internal Subroutines ******************** build_records: READNEXT @ID ELSE done = 1; RETURN READ @RECORD FROM filevar, @ID THEN IF @RECORD<<5>> = "Dallas" THEN phone = @RECORD<<3>> @RECORD<<3>> = "214 ":phone @ID = "X":@ID END END RETURN write_records: WRITE @RECORD ON filevar, @ID RETURN