From f990ac309b12c8a737ece17900a7104b4f7db511 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Wed, 14 Mar 2012 18:49:59 +0000 Subject: [PATCH] Bug 734177 - Enable foreign keys support in sqlite (r=gpascutto) --- mobile/android/base/db/BrowserProvider.java.in | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mobile/android/base/db/BrowserProvider.java.in b/mobile/android/base/db/BrowserProvider.java.in index 10397baede1..fe2c998f118 100644 --- a/mobile/android/base/db/BrowserProvider.java.in +++ b/mobile/android/base/db/BrowserProvider.java.in @@ -554,13 +554,23 @@ public class BrowserProvider extends ContentProvider { public void onOpen(SQLiteDatabase db) { debug("Opening browser.db: " + db.getPath()); + Cursor cursor = null; + if (Build.VERSION.SDK_INT >= 8) { + try { + cursor = db.rawQuery("PRAGMA foreign_keys=ON", 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(); } else { // Pre-Honeycomb, we can do some lesser optimizations. - Cursor cursor = null; + cursor = null; try { cursor = db.rawQuery("PRAGMA synchronous=NORMAL", null); } finally {