Code example for SQLiteDatabase

Methods: getPathrawQuerysetLockingEnabled, enableWriteAheadLogging

0
             } 
        } 
 
        @Override 
        public void onOpen(SQLiteDatabase db) {
            debug("Opening tabs.db: " + db.getPath());
 
            Cursor cursor = null;
            try { 
                cursor = db.rawQuery("PRAGMA synchronous=OFF", null);
            } finally { 
                if (cursor != null)
                    cursor.close();
            } 
 
            // From Honeycomb on, it's possible to run several db 
            // commands in parallel using multiple connections. 
            if (Build.VERSION.SDK_INT >= 11) {
                db.enableWriteAheadLogging();
                db.setLockingEnabled(false);
            } else { 
                // Pre-Honeycomb, we can do some lesser optimizations. 
                cursor = null;
                try { 
                    cursor = db.rawQuery("PRAGMA journal_mode=PERSIST", null);
                } finally { 
                    if (cursor != null)
                        cursor.close();
                } 
            }