package org.wlf.filedownloader.file_download.db_recorder;

import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import org.wlf.filedownloader.DownloadFileInfo;
import org.wlf.filedownloader.db.BaseContentDbDao;

/**
 * DownloadFileDao
 * <br/>
 * 操作下载文件的Dao
 *
 * @author wlf(Andy)
 * @email 411086563@qq.com
 */
public class DownloadFileDao extends BaseContentDbDao {

    public DownloadFileDao(SQLiteOpenHelper dbHelper) {
        super(dbHelper, DownloadFileInfo.Table.TABLE_NAME_OF_DOWNLOAD_FILE, DownloadFileInfo.Table
                .COLUMN_NAME_OF_FIELD_ID);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        // create table of DownloadFile
        db.execSQL(DownloadFileInfo.Table.getCreateTableSql());
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // version 1 to 2
        if (oldVersion == 1 && newVersion == 2) {
            db.execSQL(DownloadFileInfo.Table.getUpdateTableVersion1To2Sql());
        }
        // version 2 to 3
        if (oldVersion == 2 && newVersion == 3) {
            db.execSQL(DownloadFileInfo.Table.getUpdateTableVersion2To3Sql());
        }
        // version 1 to 3
        if (oldVersion == 2 && newVersion == 3) {
            db.execSQL(DownloadFileInfo.Table.getUpdateTableVersion1To2Sql());
            db.execSQL(DownloadFileInfo.Table.getUpdateTableVersion2To3Sql());
        }

    }

}

@@ -197,16 +197,56 @@
 leInfo;%0A
+import org.wlf.filedownloader.base.Log;%0A
 import o
@@ -288,16 +288,16 @@
 tDbDao;%0A
-
 %0A/**%0A * 
@@ -447,16 +447,125 @@
 bDao %7B%0A%0A
+    /**%0A     * LOG TAG%0A     */%0A    private static final String TAG = DownloadFileDao.class.getSimpleName();%0A%0A
     publ
@@ -1021,24 +1021,121 @@
 wVersion) %7B%0A
+%0A        Log.i(TAG, TAG + %22.onUpgrade%EF%BC%8ColdVersion%EF%BC%9A%22 + oldVersion + %22%EF%BC%8ColdVersion%EF%BC%9A%22 + newVersion);%0A%0A
         // v
@@ -1496,33 +1496,33 @@
  (oldVersion == 
-2
+1
  && newVersion =

fix the bug in the database upgrade with version 1 to 3