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

Commit 994bc22f authored by Vasu Nori's avatar Vasu Nori
Browse files

caching PRAGMA sql statements caused cts-tests failures.

thats a strange-bug..caching PRAGMA sql statements caused sqlite to return
incorrect results.
parent 703f0614
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) {