SQLite Android Bindings
Check-in [c45018804a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not automatically delete database files in SEE-enabled builds.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c45018804a67160dac06ca5269ac16d2192ffa5d
User & Date: dan 2013-12-25 19:13:11
Context
2013-12-26
17:31
Disable connection pooling in SQLITE_HAS_CODEC builds. Add a test for the same. check-in: 954e5a58f1 user: dan tags: trunk
2013-12-25
19:13
Do not automatically delete database files in SEE-enabled builds. check-in: c45018804a user: dan tags: trunk
19:03
Move c/c++ code into the jni/sqlite/ sub-directory. To make it easier to copy into other projects. check-in: 938b5766d5 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/org/sqlite/app/customsqlite/CustomSqlite.java.

   193    193       db.execSQL("PRAGMA key = 'secretkey'");
   194    194       res = string_from_t1_x(db);
   195    195       test_result("see_test_1.3", res, ".one.two.three");
   196    196       db.close();
   197    197   
   198    198       res = "unencrypted";
   199    199       try {
   200         -      db = SQLiteDatabase.openOrCreateDatabase(
   201         -	  DB_PATH.getPath(), null, new DoNotDeleteErrorHandler()
   202         -      );
          200  +      db = SQLiteDatabase.openOrCreateDatabase(DB_PATH.getPath(), null);
   203    201         string_from_t1_x(db);
   204    202       } catch ( SQLiteDatabaseCorruptException e ){
   205    203         res = "encrypted";
   206    204       } finally {
   207    205         db.close();
   208    206       }
   209    207       test_result("see_test_1.4", res, "encrypted");
   210    208   
   211    209       res = "unencrypted";
   212    210       try {
   213         -      db = SQLiteDatabase.openOrCreateDatabase(
   214         -	  DB_PATH.getPath(), null, new DoNotDeleteErrorHandler()
   215         -      );
          211  +      db = SQLiteDatabase.openOrCreateDatabase(DB_PATH.getPath(), null);
   216    212         db.execSQL("PRAGMA key = 'otherkey'");
   217    213         string_from_t1_x(db);
   218    214       } catch ( SQLiteDatabaseCorruptException e ){
   219    215         res = "encrypted";
   220    216       } finally {
   221    217         db.close();
   222    218       }

Changes to src/org/sqlite/database/DefaultDatabaseErrorHandler.java.

    48     48       /**
    49     49        * defines the default method to be invoked when database corruption is detected.
    50     50        * @param dbObj the {@link SQLiteDatabase} object representing the database on which corruption
    51     51        * is detected.
    52     52        */
    53     53       public void onCorruption(SQLiteDatabase dbObj) {
    54     54           Log.e(TAG, "Corruption reported by sqlite on database: " + dbObj.getPath());
           55  +
           56  +	// If this is a SEE build, do not delete any database files.
           57  +	//
           58  +	if( SQLiteDatabase.hasCodec() ) return;
    55     59   
    56     60           // is the corruption detected even before database could be 'opened'?
    57     61           if (!dbObj.isOpen()) {
    58     62               // database files are not even openable. delete this database file.
    59     63               // NOTE if the database has attached databases, then any of them could be corrupt.
    60     64               // and not deleting all of them could cause corrupted database file to remain and 
    61     65               // make the application crash on database open operation. To avoid this problem,