Compartilhar via


SQLiteOpenHelper.OnDowngrade(SQLiteDatabase, Int32, Int32) Method

Definition

Called when the database needs to be downgraded.

[Android.Runtime.Register("onDowngrade", "(Landroid/database/sqlite/SQLiteDatabase;II)V", "GetOnDowngrade_Landroid_database_sqlite_SQLiteDatabase_IIHandler")]
public virtual void OnDowngrade (Android.Database.Sqlite.SQLiteDatabase? db, int oldVersion, int newVersion);
[<Android.Runtime.Register("onDowngrade", "(Landroid/database/sqlite/SQLiteDatabase;II)V", "GetOnDowngrade_Landroid_database_sqlite_SQLiteDatabase_IIHandler")>]
abstract member OnDowngrade : Android.Database.Sqlite.SQLiteDatabase * int * int -> unit
override this.OnDowngrade : Android.Database.Sqlite.SQLiteDatabase * int * int -> unit

Parameters

db
SQLiteDatabase

The database.

oldVersion
Int32

The old database version.

newVersion
Int32

The new database version.

Attributes

Remarks

Called when the database needs to be downgraded. This is strictly similar to #onUpgrade method, but is called whenever current version is newer than requested one. However, this method is not abstract, so it is not mandatory for a customer to implement it. If not overridden, default implementation will reject downgrade and throws SQLiteException

This method executes within a transaction. If an exception is thrown, all changes will automatically be rolled back.

Java documentation for android.database.sqlite.SQLiteOpenHelper.onDowngrade(android.database.sqlite.SQLiteDatabase, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to