Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/net/tsz/afinal/FinalDb.java
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,11 @@ public void dropTable(Class<?> clazz) {

/**
* 删除所有数据表
* Changed by yinchuandong
* In the old version, the variable 'db' is global and is null initially, however, <br/>
* when onUpgrade function is called, the db is passed as local variable
*/
public void dropDb() {
public void dropDb(SQLiteDatabase db) {
Cursor cursor = db.rawQuery(
"SELECT name FROM sqlite_master WHERE type ='table' AND name != 'sqlite_sequence'", null);
if (cursor != null) {
Expand Down Expand Up @@ -891,7 +894,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (mDbUpdateListener != null) {
mDbUpdateListener.onUpgrade(db, oldVersion, newVersion);
} else { // 清空所有的数据信息
dropDb();
dropDb(db);
}
}

Expand Down