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
Database..::.Upgrade Method (String, DatabaseConfig, Boolean)
Database Class See Also

Upgrade all of the databases included in the file file, if necessary. If no upgrade is necessary, Upgrade always returns successfully.

Namespace: BerkeleyDB
Assembly: libdb_dotnet48 (in libdb_dotnet48.dll) Version: 4.8.24.0

# Syntax

C#
    public static void Upgrade(
    	string file,
    	DatabaseConfig cfg,
    	bool dupSortUpgraded
    )

Visual Basic (Declaration)
    Public Shared Sub Upgrade ( _
    	file As String, _
    	cfg As DatabaseConfig, _
    	dupSortUpgraded As Boolean _
    )

Visual C++
    public:
    static void Upgrade(
    	String^ file,
    	DatabaseConfig^ cfg,
    	bool dupSortUpgraded
    )

#### Parameters

file
  Type: System..::.String
  The physical file containing the databases to be upgraded.

cfg
  Type: BerkeleyDB..::.DatabaseConfig
  Configuration parameters for the databases to be upgraded.

dupSortUpgraded
  Type: System..::.Boolean
  If true, the duplicates in the upgraded database are sorted; otherwise they are assumed to be unsorted. This setting is only meaningful when upgrading databases from releases before the Berkeley DB 3.1 release.

# Remarks

As part of the upgrade from the Berkeley DB 3.0 release to the 3.1 release, the on-disk format of duplicate data items changed. To correctly upgrade the format requires applications to specify whether duplicate data items in the database are sorted or not. Specifying dupSortUpgraded informs Upgrade that the duplicates are sorted; otherwise they are assumed to be unsorted. Incorrectly specifying the value of this flag may lead to database corruption.

Further, because this method upgrades a physical file (including all the databases it contains), it is not possible to use Upgrade to upgrade files in which some of the databases it includes have sorted duplicate data items, and some of the databases it includes have unsorted duplicate data items. If the file does not have more than a single database, if the databases do not support duplicate data items, or if all of the databases that support duplicate data items support the same style of duplicates (either sorted or unsorted), Upgrade will work correctly as long as dupSortUpgraded is correctly specified. Otherwise, the file cannot be upgraded using Upgrade it must be upgraded manually by dumping and reloading the databases.

# See Also

Database Class
Upgrade Overload
BerkeleyDB Namespace