Renumber Field

Collapse All Expand All Code: All Code: Multiple Code: C# Code: Visual Basic Code: Visual C++

C#
Visual Basic
Visual C++

Berkeley DB .NET API Documentation
SecondaryRecnoDatabaseConfig..::.Renumber Field
SecondaryRecnoDatabaseConfig Class See Also Send Feedback

Cause the logical record numbers to be mutable, and change as records are added to and deleted from the database.

Namespace: BerkeleyDB
Assembly: libdb_dotnet62 (in libdb_dotnet62.dll) Version: 6.2.32.0

# Syntax

C#
    public bool Renumber

Visual Basic (Declaration)
    Public Renumber As Boolean

Visual C++
    public:
    bool Renumber

# Remarks

For example, the deletion of record number 4 causes records numbered 5 and greater to be renumbered downward by one. If a cursor was positioned as record number 4 before the deletion, it refers to the new record number 4, if any such record exists, after the deletion. If a cursor was positioned after record number 4 before the deletion, it is shifted downward one logical record, continuing to refer to the same record as it did before.

Using Put(MultipleKeyDatabaseEntry) or Put(DatabaseEntry, DatabaseEntry, UInt32) to create new records causes the creation of multiple records if the record number is more than one greater than the largest record currently in the database. For example, creating record 28 when record 25 was previously the last record in the database creates records 26 and 27 as well as 28. Attempts to retrieve records that were created in this manner throw a KeyEmptyException.

If a created record is not at the end of the database, all records following the new record are automatically renumbered upward by one. For example, the creation of a new record numbered 8 causes records numbered 8 and greater to be renumbered upward by one. If a cursor was positioned to record number 8 or greater before the insertion, it is shifted upward one logical record, continuing to refer to the same record as it did before.

For these reasons, concurrent access to a SecondaryRecnoDatabase with this setting specified may be largely meaningless, although it is supported.

If the database already exists, this setting must be the same as the existing database or an exception is thrown.

# See Also

SecondaryRecnoDatabaseConfig Class
BerkeleyDB Namespace