// Path: sqlite3/src/main/java/org/sqlite/database/DatabaseErrorHandler.java
// public interface DatabaseErrorHandler {
// 
//     /**
//      * The method invoked when database corruption is detected.
//      * @param dbObj the {@link SQLiteDatabase} object representing the database on which corruption
//      * is detected.
//      */
//     void onCorruption(SQLiteDatabase dbObj);
// }
// 
// Path: sqlite3/src/main/java/org/sqlite/database/DefaultDatabaseErrorHandler.java
// public final class DefaultDatabaseErrorHandler implements DatabaseErrorHandler {
// 
//     private static final String TAG = "DefaultDatabaseErrorHandler";
// 
//     /**
//      * defines the default method to be invoked when database corruption is detected.
//      * @param dbObj the {@link SQLiteDatabase} object representing the database on which corruption
//      * is detected.
//      */
//     public void onCorruption(SQLiteDatabase dbObj) {
//         Log.e(TAG, "Corruption reported by sqlite on database: " + dbObj.getPath());
// 
// 	// If this is a SEE build, do not delete any database files.
//         // It may be that the user has specified an incorrect password.
// 	if( SQLiteDatabase.hasCodec() ) return;
// 
//         // is the corruption detected even before database could be 'opened'?
//         if (!dbObj.isOpen()) {
//             // database files are not even openable. delete this database file.
//             // NOTE if the database has attached databases, then any of them could be corrupt.
//             // and not deleting all of them could cause corrupted database file to remain and 
//             // make the application crash on database open operation. To avoid this problem,
//             // the application should provide its own {@link DatabaseErrorHandler} impl class
//             // to delete ALL files of the database (including the attached databases).
//             deleteDatabaseFile(dbObj.getPath());
//             return;
//         }
// 
//         List<Pair<String, String>> attachedDbs = null;
//         try {
//             // Close the database, which will cause subsequent operations to fail.
//             // before that, get the attached database list first.
//             try {
//                 attachedDbs = dbObj.getAttachedDbs();
//             } catch (SQLiteException e) {
//                 /* ignore */
//             }
//             try {
//                 dbObj.close();
//             } catch (SQLiteException e) {
//                 /* ignore */
//             }
//         } finally {
//             // Delete all files of this corrupt database and/or attached databases
//             if (attachedDbs != null) {
//                 for (Pair<String, String> p : attachedDbs) {
//                     deleteDatabaseFile(p.second);
//                 }
//             } else {
//                 // attachedDbs = null is possible when the database is so corrupt that even
//                 // "PRAGMA database_list;" also fails. delete the main database file
//                 deleteDatabaseFile(dbObj.getPath());
//             }
//         }
//     }
// 
//     private void deleteDatabaseFile(String fileName) {
//         if (fileName.equalsIgnoreCase(":memory:") || fileName.trim().length() == 0) {
//             return;
//         }
//         Log.e(TAG, "deleting the database file: " + fileName);
//         try {
//             SQLiteDatabase.deleteDatabase(new File(fileName));
//         } catch (Exception e) {
//             /* print warning and ignore exception */
//             Log.w(TAG, "delete failed: " + e.getMessage());
//         }
//     }
// }
// 
// Path: sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteDebug.java
// public static class DbStats {
//     /** name of the database */
//     public String dbName;
// 
//     /** the page size for the database */
//     public long pageSize;
// 
//     /** the database size */
//     public long dbSize;
// 
//     /** documented here http://www.sqlite.org/c3ref/c_dbstatus_lookaside_used.html */
//     public int lookaside;
// 
//     /** statement cache stats: hits/misses/cachesize */
//     public String cache;
// 
//     public DbStats(String dbName, long pageCount, long pageSize, int lookaside,
//         int hits, int misses, int cachesize) {
//         this.dbName = dbName;
//         this.pageSize = pageSize / 1024;
//         dbSize = (pageCount * pageSize) / 1024;
//         this.lookaside = lookaside;
//         this.cache = hits + "/" + misses + "/" + cachesize;
//     }
// }


import android.content.ContentValues;
import android.database.Cursor;
import org.sqlite.database.DatabaseErrorHandler;
import org.sqlite.database.DatabaseUtils;
import org.sqlite.database.DefaultDatabaseErrorHandler;
import org.sqlite.database.SQLException;
import org.sqlite.database.sqlite.SQLiteDebug.DbStats;
import android.os.CancellationSignal;
import android.os.Looper;
import android.os.OperationCanceledException;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
import android.util.Pair;
import android.util.Printer;
import org.sqlite.database.sqlite.CloseGuard;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.WeakHashMap;
            try {
                mConnectionPoolLocked.reconfigure(mConfigurationLocked);
            } catch (RuntimeException ex) {
                mConfigurationLocked.openFlags |= ENABLE_WRITE_AHEAD_LOGGING;
                throw ex;
            }
        }
    }

    /**
     * Returns true if write-ahead logging has been enabled for this database.
     *
     * @return True if write-ahead logging has been enabled for this database.
     *
     * @see #enableWriteAheadLogging
     * @see #ENABLE_WRITE_AHEAD_LOGGING
     */
    public boolean isWriteAheadLoggingEnabled() {
        synchronized (mLock) {
            throwIfNotOpenLocked();

            return (mConfigurationLocked.openFlags & ENABLE_WRITE_AHEAD_LOGGING) != 0;
        }
    }

    /**
     * Collect statistics about all open databases in the current process.
     * Used by bug report.
     */
    static ArrayList<DbStats> getDbStats() {
// Path: sqlite3/src/main/java/org/sqlite/database/DatabaseErrorHandler.java
// public interface DatabaseErrorHandler {
// 
//     /**
//      * The method invoked when database corruption is detected.
//      * @param dbObj the {@link SQLiteDatabase} object representing the database on which corruption
//      * is detected.
//      */
//     void onCorruption(SQLiteDatabase dbObj);
// }
// 
// Path: sqlite3/src/main/java/org/sqlite/database/DefaultDatabaseErrorHandler.java
// public final class DefaultDatabaseErrorHandler implements DatabaseErrorHandler {
// 
//     private static final String TAG = "DefaultDatabaseErrorHandler";
// 
//     /**
//      * defines the default method to be invoked when database corruption is detected.
//      * @param dbObj the {@link SQLiteDatabase} object representing the database on which corruption
//      * is detected.
//      */
//     public void onCorruption(SQLiteDatabase dbObj) {
//         Log.e(TAG, "Corruption reported by sqlite on database: " + dbObj.getPath());
// 
// 	// If this is a SEE build, do not delete any database files.
//         // It may be that the user has specified an incorrect password.
// 	if( SQLiteDatabase.hasCodec() ) return;
// 
//         // is the corruption detected even before database could be 'opened'?
//         if (!dbObj.isOpen()) {
//             // database files are not even openable. delete this database file.
//             // NOTE if the database has attached databases, then any of them could be corrupt.
//             // and not deleting all of them could cause corrupted database file to remain and 
//             // make the application crash on database open operation. To avoid this problem,
//             // the application should provide its own {@link DatabaseErrorHandler} impl class
//             // to delete ALL files of the database (including the attached databases).
//             deleteDatabaseFile(dbObj.getPath());
//             return;
//         }
// 
//         List<Pair<String, String>> attachedDbs = null;
//         try {
//             // Close the database, which will cause subsequent operations to fail.
//             // before that, get the attached database list first.
//             try {
//                 attachedDbs = dbObj.getAttachedDbs();
//             } catch (SQLiteException e) {
//                 /* ignore */
//             }
//             try {
//                 dbObj.close();
//             } catch (SQLiteException e) {
//                 /* ignore */
//             }
//         } finally {
//             // Delete all files of this corrupt database and/or attached databases
//             if (attachedDbs != null) {
//                 for (Pair<String, String> p : attachedDbs) {
//                     deleteDatabaseFile(p.second);
//                 }
//             } else {
//                 // attachedDbs = null is possible when the database is so corrupt that even
//                 // "PRAGMA database_list;" also fails. delete the main database file
//                 deleteDatabaseFile(dbObj.getPath());
//             }
//         }
//     }
// 
//     private void deleteDatabaseFile(String fileName) {
//         if (fileName.equalsIgnoreCase(":memory:") || fileName.trim().length() == 0) {
//             return;
//         }
//         Log.e(TAG, "deleting the database file: " + fileName);
//         try {
//             SQLiteDatabase.deleteDatabase(new File(fileName));
//         } catch (Exception e) {
//             /* print warning and ignore exception */
//             Log.w(TAG, "delete failed: " + e.getMessage());
//         }
//     }
// }
// 
// Path: sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteDebug.java
// public static class DbStats {
//     /** name of the database */
//     public String dbName;
// 
//     /** the page size for the database */
//     public long pageSize;
// 
//     /** the database size */
//     public long dbSize;
// 
//     /** documented here http://www.sqlite.org/c3ref/c_dbstatus_lookaside_used.html */
//     public int lookaside;
// 
//     /** statement cache stats: hits/misses/cachesize */
//     public String cache;
// 
//     public DbStats(String dbName, long pageCount, long pageSize, int lookaside,
//         int hits, int misses, int cachesize) {
//         this.dbName = dbName;
//         this.pageSize = pageSize / 1024;
//         dbSize = (pageCount * pageSize) / 1024;
//         this.lookaside = lookaside;
//         this.cache = hits + "/" + misses + "/" + cachesize;
//     }
// }


// Path: sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java
import android.content.ContentValues;
import android.database.Cursor;
import org.sqlite.database.DatabaseErrorHandler;
import org.sqlite.database.DatabaseUtils;
import org.sqlite.database.DefaultDatabaseErrorHandler;
import org.sqlite.database.SQLException;
import org.sqlite.database.sqlite.SQLiteDebug.DbStats;
import android.os.CancellationSignal;
import android.os.Looper;
import android.os.OperationCanceledException;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
import android.util.Pair;
import android.util.Printer;
import org.sqlite.database.sqlite.CloseGuard;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.WeakHashMap;

            try {
                mConnectionPoolLocked.reconfigure(mConfigurationLocked);
            } catch (RuntimeException ex) {
                mConfigurationLocked.openFlags |= ENABLE_WRITE_AHEAD_LOGGING;
                throw ex;
            }
        }
    }

    /**
     * Returns true if write-ahead logging has been enabled for this database.
     *
     * @return True if write-ahead logging has been enabled for this database.
     *
     * @see #enableWriteAheadLogging
     * @see #ENABLE_WRITE_AHEAD_LOGGING
     */
    public boolean isWriteAheadLoggingEnabled() {
        synchronized (mLock) {
            throwIfNotOpenLocked();

            return (mConfigurationLocked.openFlags & ENABLE_WRITE_AHEAD_LOGGING) != 0;
        }
    }

    /**
     * Collect statistics about all open databases in the current process.
     * Used by bug report.
     */
    static ArrayList<DbStats> getDbStats() {
        ArrayList<DbStats> dbStatsList = new ArrayList<DbStats>();