Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 589eb9c5 authored by Vasu Nori's avatar Vasu Nori Committed by Android (Google) Code Review
Browse files

Merge "caching PRAGMA sql statements caused cts-tests failures."

parents 72666bac 994bc22f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1860,6 +1860,14 @@ public class SQLiteDatabase extends SQLiteClosable {
            return;
        }

        /* don't cache PRAGMA sql statements.
         * caching them makes sqlite return incorrect results on pragma sql execution!
         */
        String prefixSql = sql.substring(0, 6);
        if (prefixSql.toLowerCase().startsWith("pragma")) {
            return;
        }

        SQLiteCompiledSql compiledSql = null;
        synchronized(mCompiledQueries) {
            // don't insert the new mapping if a mapping already exists
@@ -1925,6 +1933,12 @@ public class SQLiteDatabase extends SQLiteClosable {
     * returns null, if not found in the cache.
     */
    /* package */ SQLiteCompiledSql getCompiledStatementForSql(String sql) {
        // don't look for PRAGMA sql statements in compiled-sql cache
        String prefixSql = sql.substring(0, 6);
        if (prefixSql.toLowerCase().startsWith("pragma")) {
            return null;
        }

        SQLiteCompiledSql compiledStatement = null;
        boolean cacheHit;
        synchronized(mCompiledQueries) {