java.lang.Object | |
↳ | com.tencent.wcdb.repair.RepairKit.MasterInfo |
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
.
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
|
Load backup information from file and create a MasterInfo
object. Table filters can be applied while loading.
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 |
MasterInfo
object just created
Create a MasterInfo
object with no backup information.
The only scenario to call this method is to apply table filters
for recovery.
tables | array of table names to include in the filter |
---|
MasterInfo
object just created
Close corrupted database and release all resources. This should be called when recovery is finished. No further method calls on this object after calling.
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)
.
db | database to be backed up |
---|---|
path | output path to the backup file |
key | passphrase to the backup file, or null for no encryption |