Merge "Revert "Clear statement cache if schema changes."" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5003af01e0
@@ -1392,10 +1392,6 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen
|
|||||||
return sql.replaceAll("[\\s]*\\n+[\\s]*", " ");
|
return sql.replaceAll("[\\s]*\\n+[\\s]*", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearPreparedStatementCache() {
|
|
||||||
mPreparedStatementCache.evictAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holder type for a prepared statement.
|
* Holder type for a prepared statement.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1126,16 +1126,6 @@ public final class SQLiteConnectionPool implements Closeable {
|
|||||||
mConnectionWaiterPool = waiter;
|
mConnectionWaiterPool = waiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearAcquiredConnectionsPreparedStatementCache() {
|
|
||||||
synchronized (mLock) {
|
|
||||||
if (!mAcquiredConnections.isEmpty()) {
|
|
||||||
for (SQLiteConnection connection : mAcquiredConnections.keySet()) {
|
|
||||||
connection.clearPreparedStatementCache();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dumps debugging information about this connection pool.
|
* Dumps debugging information about this connection pool.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2088,12 +2088,10 @@ public final class SQLiteDatabase extends SQLiteClosable {
|
|||||||
try (SQLiteStatement statement = new SQLiteStatement(this, sql, bindArgs)) {
|
try (SQLiteStatement statement = new SQLiteStatement(this, sql, bindArgs)) {
|
||||||
return statement.executeUpdateDelete();
|
return statement.executeUpdateDelete();
|
||||||
} finally {
|
} finally {
|
||||||
// If schema was updated, close non-primary connections and clear prepared
|
// If schema was updated, close non-primary connections, otherwise they might
|
||||||
// statement caches of active connections, otherwise they might have outdated
|
// have outdated schema information
|
||||||
// schema information.
|
|
||||||
if (statementType == DatabaseUtils.STATEMENT_DDL) {
|
if (statementType == DatabaseUtils.STATEMENT_DDL) {
|
||||||
mConnectionPoolLocked.closeAvailableNonPrimaryConnectionsAndLogExceptions();
|
mConnectionPoolLocked.closeAvailableNonPrimaryConnectionsAndLogExceptions();
|
||||||
mConnectionPoolLocked.clearAcquiredConnectionsPreparedStatementCache();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user