// Path: src/main/java/org/jraf/irondad/Config.java
// public class Config {
// 
//     public static final boolean LOGD = true;
// 
// }
// 
// Path: src/main/java/org/jraf/irondad/Constants.java
// public class Constants {
//     public static final String TAG = "irondad/";
// 
//     public static final String PROJECT_FULL_NAME = "BoD irondad";
//     public static final String PROJECT_URL = "https://github.com/BoD/irondad";
//     public static final String VERSION_NAME = "v1.11.1"; // xxx When updating this, don't forget to update the version in pom.xml as well
// }
// 
// Path: src/main/java/org/jraf/irondad/util/Log.java
// public class Log {
//     public static void w(String tag, String msg, Throwable t) {
//         System.out.print(getDate() + " W " + tag + " " + msg + "\n" + getStackTraceString(t));
//     }
// 
//     public static void w(String tag, String msg) {
//         System.out.print(getDate() + " W " + tag + " " + msg + "\n");
//     }
// 
//     public static void e(String tag, String msg, Throwable t) {
//         System.out.print(getDate() + " E " + tag + " " + msg + "\n" + getStackTraceString(t));
//     }
// 
//     public static void e(String tag, String msg) {
//         System.out.print(getDate() + " E " + tag + " " + msg + "\n");
//     }
// 
//     public static void d(String tag, String msg, Throwable t) {
//         System.out.print(getDate() + " D " + tag + " " + msg + "\n" + getStackTraceString(t));
//     }
// 
//     public static void d(String tag, String msg) {
//         System.out.print(getDate() + " D " + tag + " " + msg + "\n");
//     }
// 
//     public static void i(String tag, String msg, Throwable t) {
//         System.out.print(getDate() + " I " + tag + " " + msg + "\n" + getStackTraceString(t));
//     }
// 
//     public static void i(String tag, String msg) {
//         System.out.print(getDate() + " I " + tag + " " + msg + "\n");
//     }
// 
//     private static String getDate() {
//         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd/HH:mm:ss");
//         return sdf.format(new Date());
//     }
// 
//     private static String getStackTraceString(Throwable tr) {
//         if (tr == null) {
//             return "";
//         }
// 
//         StringWriter sw = new StringWriter();
//         PrintWriter pw = new PrintWriter(sw);
//         tr.printStackTrace(pw);
//         return sw.toString();
//     }
// }


import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.Random;
import org.jraf.irondad.Config;
import org.jraf.irondad.Constants;
import org.jraf.irondad.util.Log;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
            "quote" +
            " WHERE " +
            "channel=?";
    
    private static final String SQL_CHECK_QUOTE_EXISTS = "SELECT " +
            "count(_id)" +
            " FROM " +
            "quote" +
            " WHERE " +
            "channel=? and _text=?";
    
    private static final String SQL_DELETE = "DELETE " +
            " FROM " +
            "quote" +
            " WHERE " +
            "_id=?";
    //@formatter:on

    public static final int ERR_SQL_PROBLEM = -1;
    public static final int ERR_QUOTE_ALREADY_EXISTS = -2;

    private Connection mConnection;

    private ArrayList<Integer> mRandomOrder;
    private int mRandomIdx;

    public DbManager(String dbPath) {
        try {
            Class.forName("org.sqlite.JDBC");
        } catch (ClassNotFoundException e) {
// Path: src/main/java/org/jraf/irondad/Config.java
// public class Config {
// 
//     public static final boolean LOGD = true;
// 
// }
// 
// Path: src/main/java/org/jraf/irondad/Constants.java
// public class Constants {
//     public static final String TAG = "irondad/";
// 
//     public static final String PROJECT_FULL_NAME = "BoD irondad";
//     public static final String PROJECT_URL = "https://github.com/BoD/irondad";
//     public static final String VERSION_NAME = "v1.11.1"; // xxx When updating this, don't forget to update the version in pom.xml as well
// }
// 
// Path: src/main/java/org/jraf/irondad/util/Log.java
// public class Log {
//     public static void w(String tag, String msg, Throwable t) {
//         System.out.print(getDate() + " W " + tag + " " + msg + "\n" + getStackTraceString(t));
//     }
// 
//     public static void w(String tag, String msg) {
//         System.out.print(getDate() + " W " + tag + " " + msg + "\n");
//     }
// 
//     public static void e(String tag, String msg, Throwable t) {
//         System.out.print(getDate() + " E " + tag + " " + msg + "\n" + getStackTraceString(t));
//     }
// 
//     public static void e(String tag, String msg) {
//         System.out.print(getDate() + " E " + tag + " " + msg + "\n");
//     }
// 
//     public static void d(String tag, String msg, Throwable t) {
//         System.out.print(getDate() + " D " + tag + " " + msg + "\n" + getStackTraceString(t));
//     }
// 
//     public static void d(String tag, String msg) {
//         System.out.print(getDate() + " D " + tag + " " + msg + "\n");
//     }
// 
//     public static void i(String tag, String msg, Throwable t) {
//         System.out.print(getDate() + " I " + tag + " " + msg + "\n" + getStackTraceString(t));
//     }
// 
//     public static void i(String tag, String msg) {
//         System.out.print(getDate() + " I " + tag + " " + msg + "\n");
//     }
// 
//     private static String getDate() {
//         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd/HH:mm:ss");
//         return sdf.format(new Date());
//     }
// 
//     private static String getStackTraceString(Throwable tr) {
//         if (tr == null) {
//             return "";
//         }
// 
//         StringWriter sw = new StringWriter();
//         PrintWriter pw = new PrintWriter(sw);
//         tr.printStackTrace(pw);
//         return sw.toString();
//     }
// }


// Path: src/main/java/org/jraf/irondad/handler/quote/DbManager.java
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.Random;
import org.jraf.irondad.Config;
import org.jraf.irondad.Constants;
import org.jraf.irondad.util.Log;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

            "quote" +
            " WHERE " +
            "channel=?";
    
    private static final String SQL_CHECK_QUOTE_EXISTS = "SELECT " +
            "count(_id)" +
            " FROM " +
            "quote" +
            " WHERE " +
            "channel=? and _text=?";
    
    private static final String SQL_DELETE = "DELETE " +
            " FROM " +
            "quote" +
            " WHERE " +
            "_id=?";
    //@formatter:on

    public static final int ERR_SQL_PROBLEM = -1;
    public static final int ERR_QUOTE_ALREADY_EXISTS = -2;

    private Connection mConnection;

    private ArrayList<Integer> mRandomOrder;
    private int mRandomIdx;

    public DbManager(String dbPath) {
        try {
            Class.forName("org.sqlite.JDBC");
        } catch (ClassNotFoundException e) {
            Log.e(TAG, "DbManager Could not intialize jdbc driver", e);