// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_ID = "id";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Image = "image";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Message = "message";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Name = "name";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Next_Message = "next_message";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Next_SubName = "next_sub_name";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Original_ID = "original_name";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Prev_Message = "prev_message";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Prev_SubName = "prev_sub_name";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_SubName = "sub_name";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Time = "time";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Table_Recalled_Messages = "recalls";


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import static com.qsboy.antirecall.db.DBHelper.Column_ID;
import static com.qsboy.antirecall.db.DBHelper.Column_Image;
import static com.qsboy.antirecall.db.DBHelper.Column_Message;
import static com.qsboy.antirecall.db.DBHelper.Column_Name;
import static com.qsboy.antirecall.db.DBHelper.Column_Next_Message;
import static com.qsboy.antirecall.db.DBHelper.Column_Next_SubName;
import static com.qsboy.antirecall.db.DBHelper.Column_Original_ID;
import static com.qsboy.antirecall.db.DBHelper.Column_Prev_Message;
import static com.qsboy.antirecall.db.DBHelper.Column_Prev_SubName;
import static com.qsboy.antirecall.db.DBHelper.Column_SubName;
import static com.qsboy.antirecall.db.DBHelper.Column_Time;
import static com.qsboy.antirecall.db.DBHelper.Table_Recalled_Messages;
    private HashMap<String, Boolean> existTables = new HashMap<>();

    private Dao(DBHelper dbHelper) {
        db = dbHelper.getWritableDatabase();
    }

    public static Dao getInstance(Context context, String dbName) {
        if (DB_NAME_QQ.equals(dbName)) {
            TAG = "QQ Dao";
            if (instanceQQ == null)
                instanceQQ = new Dao(new DBHelper(context, DB_NAME_QQ, null, 6));
            return instanceQQ;
        }
        if (DB_NAME_WE_CHAT.equals(dbName)) {
            TAG = "WeChat Dao";
            if (instanceWeChat == null)
                instanceWeChat = new Dao(new DBHelper(context, DB_NAME_WE_CHAT, null, 6));
            return instanceWeChat;
        }
        return null;
    }

    private void closeCursor() {
        if (cursor != null)
            cursor.close();
    }

    private void createTableIfNotExists(String name) {
        String sqlCreateTable = "CREATE TABLE IF NOT EXISTS " + getSafeName(name) + " (" +
                Column_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_ID = "id";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Image = "image";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Message = "message";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Name = "name";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Next_Message = "next_message";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Next_SubName = "next_sub_name";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Original_ID = "original_name";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Prev_Message = "prev_message";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Prev_SubName = "prev_sub_name";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_SubName = "sub_name";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Column_Time = "time";
// 
// Path: app/src/main/java/com/qsboy/antirecall/db/DBHelper.java
// public static final String Table_Recalled_Messages = "recalls";


// Path: app/src/main/java/com/qsboy/antirecall/db/Dao.java
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import static com.qsboy.antirecall.db.DBHelper.Column_ID;
import static com.qsboy.antirecall.db.DBHelper.Column_Image;
import static com.qsboy.antirecall.db.DBHelper.Column_Message;
import static com.qsboy.antirecall.db.DBHelper.Column_Name;
import static com.qsboy.antirecall.db.DBHelper.Column_Next_Message;
import static com.qsboy.antirecall.db.DBHelper.Column_Next_SubName;
import static com.qsboy.antirecall.db.DBHelper.Column_Original_ID;
import static com.qsboy.antirecall.db.DBHelper.Column_Prev_Message;
import static com.qsboy.antirecall.db.DBHelper.Column_Prev_SubName;
import static com.qsboy.antirecall.db.DBHelper.Column_SubName;
import static com.qsboy.antirecall.db.DBHelper.Column_Time;
import static com.qsboy.antirecall.db.DBHelper.Table_Recalled_Messages;

    private HashMap<String, Boolean> existTables = new HashMap<>();

    private Dao(DBHelper dbHelper) {
        db = dbHelper.getWritableDatabase();
    }

    public static Dao getInstance(Context context, String dbName) {
        if (DB_NAME_QQ.equals(dbName)) {
            TAG = "QQ Dao";
            if (instanceQQ == null)
                instanceQQ = new Dao(new DBHelper(context, DB_NAME_QQ, null, 6));
            return instanceQQ;
        }
        if (DB_NAME_WE_CHAT.equals(dbName)) {
            TAG = "WeChat Dao";
            if (instanceWeChat == null)
                instanceWeChat = new Dao(new DBHelper(context, DB_NAME_WE_CHAT, null, 6));
            return instanceWeChat;
        }
        return null;
    }

    private void closeCursor() {
        if (cursor != null)
            cursor.close();
    }

    private void createTableIfNotExists(String name) {
        String sqlCreateTable = "CREATE TABLE IF NOT EXISTS " + getSafeName(name) + " (" +
                Column_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
                Column_SubName + " TEXT, " +