TMedConnection.MedSetPerf TMedConnection

function MedSetPerf( lNewMode: Boolean ): Boolean;

Description

Method changes the mode used when opening Mediator tables. After calling MedSetPerf(true) all following tables are opened in the mode allowing a non-continuous record numbering (perforated RECNO mode). After the calling of MedSetPerf(false) all following table openings are made in the 100% CA-Clipper compatible mode, which does not allow a non-continuous record numbering. On an application startup, the CA-Clipper compatible mode is active (no perforated RECNO allowed).

Method returns the logical value indicating the previously active open mode. If called without the parameters, the function returns the active mode but does not change it.

Warning!

If at least one application opens the table in a perforated numbering mode, the opening mode for this table is automatically converted to "perforated" for all other applications, including the applications having this table already opened. In such a situation, if another application tries to open the table in a "non-perforated" mode, the "perforated" opening will be forced. All that means that the table opening mode may change from a "non-perforated" to a "perforated", even after the table is opened. The vice-versa change is not possible. To check the actual mode of the table use MedPerfMod method.

To avoid confusion, related to numbering modes, we strongly recommend opening a given table from all applications in the same numbering mode. However, it is perfectly legal (and very useful) to have in one application tables opened in "perforated" and "non-perforated" modes. The typical candidates for "perforated" opening are tables to which you add records within the transaction.

Opening tables in a non-continuous numbering (perforated) mode has been possible since version 3.0 of Mediator. When the table is opened in a non-continuous record numbering mode, then Mediator does not need to wait to append a new records to the table until all other transactions inserting into this table are finished, but immediately calculates the new record number and proceeds with its insertion. This method may cause the "holes" in a record numbering. Such a "numbering hole" may be created if record inserting transaction is rolled back at the moment when other applications have already inserted records with higher record numbers. The records inserted within the rolled back transaction are removed, and a "numbering hole" remains. Using a non-continuous ("perforated") numbering mode facilitates the usage of transactions (eliminates the possibility of the deadlock), but has the following consequences:

ˇTMedTable.RecordCount method called on the table with non-continuous record numbers return the number of the last record, not the actual number of records. To obtain the accurate number of records in such a table, call TMedTable.MedPerfRC method.

ˇThe application may not assume a continuous record numbering

ˇAn attempt to set TMedTable.RecNo to the record which does not exist, results in positioning the cursor on the phantom record and setting TMedTable.Eof to true.