diff options
| author | 2023-03-09 22:19:45 +0000 | |
|---|---|---|
| committer | 2023-03-09 22:19:45 +0000 | |
| commit | 5003af01e059e88da3baae2d4e97e170b021a2e4 (patch) | |
| tree | f209d8992a57a36459c45ebedbe330e8fcfce2ee | |
| parent | fde45f72b32b4f83c8d9d2fc0118e26fefc4222e (diff) | |
| parent | c5947e577ef5a149cfc3b3c52b14a95df2e2a793 (diff) | |
Merge "Revert "Clear statement cache if schema changes."" into udc-dev
3 files changed, 2 insertions, 18 deletions
diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java index 45326610fbd0..4b3eb3a000ff 100644 --- a/core/java/android/database/sqlite/SQLiteConnection.java +++ b/core/java/android/database/sqlite/SQLiteConnection.java @@ -1392,10 +1392,6 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen return sql.replaceAll("[\\s]*\\n+[\\s]*", " "); } - void clearPreparedStatementCache() { - mPreparedStatementCache.evictAll(); - } - /** * Holder type for a prepared statement. * diff --git a/core/java/android/database/sqlite/SQLiteConnectionPool.java b/core/java/android/database/sqlite/SQLiteConnectionPool.java index 6023d66b9c88..069c264313e7 100644 --- a/core/java/android/database/sqlite/SQLiteConnectionPool.java +++ b/core/java/android/database/sqlite/SQLiteConnectionPool.java @@ -1126,16 +1126,6 @@ public final class SQLiteConnectionPool implements Closeable { mConnectionWaiterPool = waiter; } - void clearAcquiredConnectionsPreparedStatementCache() { - synchronized (mLock) { - if (!mAcquiredConnections.isEmpty()) { - for (SQLiteConnection connection : mAcquiredConnections.keySet()) { - connection.clearPreparedStatementCache(); - } - } - } - } - /** * Dumps debugging information about this connection pool. * diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java index db898c3b7b5d..c08294f42c45 100644 --- a/core/java/android/database/sqlite/SQLiteDatabase.java +++ b/core/java/android/database/sqlite/SQLiteDatabase.java @@ -2088,12 +2088,10 @@ public final class SQLiteDatabase extends SQLiteClosable { try (SQLiteStatement statement = new SQLiteStatement(this, sql, bindArgs)) { return statement.executeUpdateDelete(); } finally { - // If schema was updated, close non-primary connections and clear prepared - // statement caches of active connections, otherwise they might have outdated - // schema information. + // If schema was updated, close non-primary connections, otherwise they might + // have outdated schema information if (statementType == DatabaseUtils.STATEMENT_DDL) { mConnectionPoolLocked.closeAvailableNonPrimaryConnectionsAndLogExceptions(); - mConnectionPoolLocked.clearAcquiredConnectionsPreparedStatementCache(); } } } finally { |