public static class

RepairKit.MasterInfo

extends Object
java.lang.Object
   ↳ com.tencent.wcdb.repair.RepairKit.MasterInfo

Class Overview

Class represent master info backed up from a SQLiteDatabase, which can be used in recovery on database file with corrupted header.

Table filters can be applied while loading from file or creating an empty MasterInfo.

Summary

Public Methods
static RepairKit.MasterInfo load(String path, byte[] key, String[] tables)
Load backup information from file and create a MasterInfo object.
static RepairKit.MasterInfo make(String[] tables)
Create a MasterInfo object with no backup information.
void release()
Close corrupted database and release all resources.
static boolean save(SQLiteDatabase db, String path, byte[] key)
Save backup information from an opened SQLiteDatabase for later corruption recovery.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static RepairKit.MasterInfo load (String path, byte[] key, String[] tables)

Load backup information from file and create a MasterInfo object. Table filters can be applied while loading.

Parameters
path path to the backup file
key passphrase to the encrypted backup file, or null for plain-text backup file
tables array of table names to include in the filter
Returns
  • MasterInfo object just created

public static RepairKit.MasterInfo make (String[] tables)

Create a MasterInfo object with no backup information. The only scenario to call this method is to apply table filters for recovery.

Parameters
tables array of table names to include in the filter
Returns
  • MasterInfo object just created

public void release ()

Close corrupted database and release all resources. This should be called when recovery is finished. No further method calls on this object after calling.

public static boolean save (SQLiteDatabase db, String path, byte[] key)

Save backup information from an opened SQLiteDatabase for later corruption recovery.

Call this method BEFORE database corruption. Backup data will not change unless database schema is modified, by executing, e.g. CREATE TABLE, CREATE INDEX or ALTER TABLE statements.

Best practise would be backing up when database just finished creation or upgrade, which would be placed in onCreate(SQLiteDatabase) or onUpgrade(SQLiteDatabase, int, int).

Parameters
db database to be backed up
path output path to the backup file
key passphrase to the backup file, or null for no encryption
Returns
  • true if backup is finished successfully