TMedTable.RecNumberingMode TMedTable

property RecNumberingMode: TMedRecNumberingMode ;

Description

Every record managed by Mediator ISAM server has its number held in hidden RECNO column.

Use this property before table activation to set desired record numbering mode for the table. There are three possible settings of RecNumberingMode property:

·rnmDefault - the default setting. The actual locking method is determined at the moment of dataset activation by using TMedConnection.RecNumberingMode property value.

·rnmContinuous - selects continuous record numbering mode.

·rnmPerforated - selects perforated record numbering mode. In this mode there may be holes in record numbers.

In rnmPerforated mode the table is opened in the mode allowing a non-continuous record numbering (perforated RECNO mode). In rnmContinuous mode the table is opened in the CA-Clipper compatible mode, which does not allow a non-continuous record numbering.

Warning!

If even one application opens the table in a rnmPerforated 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. While the RecNumberingMode may remain rnmContinuous, the actual table behavior will follow rnmPerforated mode rules.

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 rnmPerforated and rnmContinuous modes. The typical candidates for "perforated" opening are tables to which you add records within the transaction.

When the table is opened in a rnmPerforated record numbering mode, Mediator server 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 rnmPerforated numbering mode facilitates the usage of transactions (eliminates the possibility of the deadlock), but has the following consequences:

·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 THbTable.MedPerfRC() function.

·The application may not assume a continuous record numbering

·An attempt to GOTO to the record which does not exist, results in positioning the cursor on the phantom record (EOF()==.T.).