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

Causes 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

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.

If a deleted record is not at the end of the database, all records following the removed record are 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 is 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 are no longer 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()()() returns false until the cursor is moved to another record. A call to MoveNext()()() returns 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 is thrown.

# See Also

RecnoDatabaseConfig Class
BerkeleyDB Namespace