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
RecnoDatabaseConfig..::.Renumber Field
RecnoDatabaseConfig 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_dotnet60 (in libdb_dotnet60.dll) Version: 6.0.19.0

# Syntax

C#
    public bool Renumber

Visual Basic (Declaration)
    Public Renumber As Boolean

Visual C++
    public:
    bool Renumber

# Remarks

Using Put(MultipleKeyDatabaseEntry) or Put(DatabaseEntry, DatabaseEntry, UInt32) to create new records will cause 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, will create records 26 and 27 as well as 28. Attempts to retrieve records that were created in this manner will throw a KeyEmptyException.

If a created record is not at the end of the database, all records following the new record will be 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 will be shifted upward one logical record, continuing to refer to the same record as it did before.

If a deleted record is not at the end of the database, all records following the removed record will be automatically renumbered downward by one. For example, deleting the record numbered 8 causes records numbered 9 and greater to be renumbered downward by one. If a cursor was positioned to record number 9 or greater before the removal, it will be shifted downward one logical record, continuing to refer to the same record as it did before.

If a record is deleted, all cursors that were positioned on that record prior to the removal will no longer be positioned on a valid entry. This includes cursors used to delete an item. For example, if a cursor was positioned to record number 8 before the removal of that record, subsequent calls to Refresh()()() will return false until the cursor is moved to another record. A call to MoveNext()()() will return the new record numbered 8 - which is the record that was numbered 9 prior to the delete (if such a record existed).

For these reasons, concurrent access to a RecnoDatabase 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 will be thrown.

# See Also

RecnoDatabaseConfig Class
BerkeleyDB Namespace