Loading core/java/android/database/sqlite/SQLiteCompiledSql.java +12 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,9 @@ import android.util.Log; // Note that native_finalize() checks to make sure that nStatement is // non-null before destroying it. if (nStatement != 0) { if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "closed and deallocated DbObj (id#" + nStatement +")"); } try { mDatabase.lock(); native_finalize(); Loading @@ -112,10 +115,16 @@ import android.util.Log; return false; } mInUse = true; if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "Acquired DbObj (id#" + nStatement + ") from DB cache"); } return true; } /* package */ synchronized void release() { if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "Released DbObj (id#" + nStatement + ") back to DB cache"); } mInUse = false; } Loading @@ -127,6 +136,9 @@ import android.util.Log; try { if (nStatement == 0) return; // finalizer should NEVER get called if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "** warning ** Finalized DbObj (id#" + nStatement + ")"); } Log.w(TAG, "finalizer should never be called on sql: " + mSqlStmt, mStackTrace); releaseSqlStatement(); } finally { Loading core/java/android/database/sqlite/SQLiteProgram.java +16 −2 Original line number Diff line number Diff line Loading @@ -16,11 +16,15 @@ package android.database.sqlite; import android.util.Log; /** * A base class for compiled SQLite programs. */ public abstract class SQLiteProgram extends SQLiteClosable { private static final String TAG = "SQLiteProgram"; /** The database this program is compiled against. * @deprecated do not use this */ Loading Loading @@ -80,16 +84,26 @@ public abstract class SQLiteProgram extends SQLiteClosable { // make sure it is acquired by me. mCompiledSql.acquire(); db.addToCompiledQueries(sql, mCompiledSql); if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "Created DbObj (id#" + mCompiledSql.nStatement + ") for sql: " + sql); } } else { // it is already in compiled-sql cache. // try to acquire the object. if (!mCompiledSql.acquire()) { int last = mCompiledSql.nStatement; // the SQLiteCompiledSql in cache is in use by some other SQLiteProgram object. // we can't have two different SQLiteProgam objects can't share the same // CompiledSql object. create a new one. // finalize it when I am done with it in "this" object. mCompiledSql = new SQLiteCompiledSql(db, sql); if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "** possible bug ** Created NEW DbObj (id#" + mCompiledSql.nStatement + ") because the previously created DbObj (id#" + last + ") was not released for sql:" + sql); } // since it is not in the cache, no need to acquire() it. } } Loading Loading
core/java/android/database/sqlite/SQLiteCompiledSql.java +12 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,9 @@ import android.util.Log; // Note that native_finalize() checks to make sure that nStatement is // non-null before destroying it. if (nStatement != 0) { if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "closed and deallocated DbObj (id#" + nStatement +")"); } try { mDatabase.lock(); native_finalize(); Loading @@ -112,10 +115,16 @@ import android.util.Log; return false; } mInUse = true; if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "Acquired DbObj (id#" + nStatement + ") from DB cache"); } return true; } /* package */ synchronized void release() { if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "Released DbObj (id#" + nStatement + ") back to DB cache"); } mInUse = false; } Loading @@ -127,6 +136,9 @@ import android.util.Log; try { if (nStatement == 0) return; // finalizer should NEVER get called if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "** warning ** Finalized DbObj (id#" + nStatement + ")"); } Log.w(TAG, "finalizer should never be called on sql: " + mSqlStmt, mStackTrace); releaseSqlStatement(); } finally { Loading
core/java/android/database/sqlite/SQLiteProgram.java +16 −2 Original line number Diff line number Diff line Loading @@ -16,11 +16,15 @@ package android.database.sqlite; import android.util.Log; /** * A base class for compiled SQLite programs. */ public abstract class SQLiteProgram extends SQLiteClosable { private static final String TAG = "SQLiteProgram"; /** The database this program is compiled against. * @deprecated do not use this */ Loading Loading @@ -80,16 +84,26 @@ public abstract class SQLiteProgram extends SQLiteClosable { // make sure it is acquired by me. mCompiledSql.acquire(); db.addToCompiledQueries(sql, mCompiledSql); if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "Created DbObj (id#" + mCompiledSql.nStatement + ") for sql: " + sql); } } else { // it is already in compiled-sql cache. // try to acquire the object. if (!mCompiledSql.acquire()) { int last = mCompiledSql.nStatement; // the SQLiteCompiledSql in cache is in use by some other SQLiteProgram object. // we can't have two different SQLiteProgam objects can't share the same // CompiledSql object. create a new one. // finalize it when I am done with it in "this" object. mCompiledSql = new SQLiteCompiledSql(db, sql); if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { Log.v(TAG, "** possible bug ** Created NEW DbObj (id#" + mCompiledSql.nStatement + ") because the previously created DbObj (id#" + last + ") was not released for sql:" + sql); } // since it is not in the cache, no need to acquire() it. } } Loading