diff options
Diffstat (limited to 'core/java/android/database')
-rw-r--r-- | core/java/android/database/sqlite/SQLiteConnection.java | 8 | ||||
-rw-r--r-- | core/java/android/database/sqlite/SQLiteCursor.java | 1 | ||||
-rw-r--r-- | core/java/android/database/sqlite/SQLiteDebug.java | 87 |
3 files changed, 6 insertions, 90 deletions
diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java index aeca62d..2ea936e 100644 --- a/core/java/android/database/sqlite/SQLiteConnection.java +++ b/core/java/android/database/sqlite/SQLiteConnection.java @@ -84,6 +84,7 @@ import java.util.regex.Pattern; */ public final class SQLiteConnection { private static final String TAG = "SQLiteConnection"; + private static final boolean DEBUG = false; private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; @@ -668,11 +669,12 @@ public final class SQLiteConnection { // When remove() is called, the cache will invoke its entryRemoved() callback, // which will in turn call finalizePreparedStatement() to finalize and // recycle the statement. - if (SQLiteDebug.DEBUG_SQL_CACHE) { - Log.v(TAG, "Could not reset prepared statement due to an exception. " + if (DEBUG) { + Log.d(TAG, "Could not reset prepared statement due to an exception. " + "Removing it from the cache. SQL: " + trimSqlForDisplay(statement.mSql), ex); } + mPreparedStatementCache.remove(statement.mSql); } } else { @@ -995,7 +997,7 @@ public final class SQLiteConnection { } private static final class OperationLog { - private static final int MAX_RECENT_OPERATIONS = 10; + private static final int MAX_RECENT_OPERATIONS = 20; private static final int COOKIE_GENERATION_SHIFT = 8; private static final int COOKIE_INDEX_MASK = 0xff; diff --git a/core/java/android/database/sqlite/SQLiteCursor.java b/core/java/android/database/sqlite/SQLiteCursor.java index 9dcb498..946300f 100644 --- a/core/java/android/database/sqlite/SQLiteCursor.java +++ b/core/java/android/database/sqlite/SQLiteCursor.java @@ -269,7 +269,6 @@ public class SQLiteCursor extends AbstractWindowedCursor { mStackTrace); } close(); - SQLiteDebug.notifyActiveCursorFinalized(); } } finally { super.finalize(); diff --git a/core/java/android/database/sqlite/SQLiteDebug.java b/core/java/android/database/sqlite/SQLiteDebug.java index a64251b..3ef9b49 100644 --- a/core/java/android/database/sqlite/SQLiteDebug.java +++ b/core/java/android/database/sqlite/SQLiteDebug.java @@ -49,31 +49,6 @@ public final class SQLiteDebug { Log.isLoggable("SQLiteTime", Log.VERBOSE); /** - * Controls the printing of compiled-sql-statement cache stats. - */ - public static final boolean DEBUG_SQL_CACHE = - Log.isLoggable("SQLiteCompiledSql", Log.VERBOSE); - - /** - * Controls the stack trace reporting of active cursors being - * finalized. - */ - public static final boolean DEBUG_ACTIVE_CURSOR_FINALIZATION = - Log.isLoggable("SQLiteCursorClosing", Log.VERBOSE); - - /** - * Controls the tracking of time spent holding the database lock. - */ - public static final boolean DEBUG_LOCK_TIME_TRACKING = - Log.isLoggable("SQLiteLockTime", Log.VERBOSE); - - /** - * Controls the printing of stack traces when tracking the time spent holding the database lock. - */ - public static final boolean DEBUG_LOCK_TIME_TRACKING_STACK_TRACE = - Log.isLoggable("SQLiteLockStackTrace", Log.VERBOSE); - - /** * True to enable database performance testing instrumentation. * @hide */ @@ -101,27 +76,6 @@ public final class SQLiteDebug { * @see #getPagerStats(PagerStats) */ public static class PagerStats { - /** The total number of bytes in all pagers in the current process - * @deprecated not used any longer - */ - @Deprecated - public long totalBytes; - /** The number of bytes in referenced pages in all pagers in the current process - * @deprecated not used any longer - * */ - @Deprecated - public long referencedBytes; - /** The number of bytes in all database files opened in the current process - * @deprecated not used any longer - */ - @Deprecated - public long databaseBytes; - /** The number of pagers opened in the current process - * @deprecated not used any longer - */ - @Deprecated - public int numPagers; - /** the current amount of memory checked out by sqlite using sqlite3_malloc(). * documented at http://www.sqlite.org/c3ref/c_status_malloc_size.html */ @@ -134,7 +88,7 @@ public final class SQLiteDebug { * that overflowed because no space was left in the page cache. * documented at http://www.sqlite.org/c3ref/c_status_malloc_size.html */ - public int pageCacheOverflo; + public int pageCacheOverflow; /** records the largest memory allocation request handed to sqlite3. * documented at http://www.sqlite.org/c3ref/c_status_malloc_size.html @@ -207,43 +161,4 @@ public final class SQLiteDebug { * Gathers statistics about all pagers in the current process. */ public static native void getPagerStats(PagerStats stats); - - /** - * Returns the size of the SQLite heap. - * @return The size of the SQLite heap in bytes. - */ - public static native long getHeapSize(); - - /** - * Returns the amount of allocated memory in the SQLite heap. - * @return The allocated size in bytes. - */ - public static native long getHeapAllocatedSize(); - - /** - * Returns the amount of free memory in the SQLite heap. - * @return The freed size in bytes. - */ - public static native long getHeapFreeSize(); - - /** - * Determines the number of dirty belonging to the SQLite - * heap segments of this process. pages[0] returns the number of - * shared pages, pages[1] returns the number of private pages - */ - public static native void getHeapDirtyPages(int[] pages); - - private static int sNumActiveCursorsFinalized = 0; - - /** - * Returns the number of active cursors that have been finalized. This depends on the GC having - * run but is still useful for tests. - */ - public static int getNumActiveCursorsFinalized() { - return sNumActiveCursorsFinalized; - } - - static synchronized void notifyActiveCursorFinalized() { - sNumActiveCursorsFinalized++; - } } |