android - How to enable programatically sqlite foreign key support? -


in documentation of sqlite syntax pragma foreign_keys = on; enables foreign key support. code in android ?

you can override onopen in class extends sqliteopenhelper this:

@override public void onopen(sqlitedatabase db) {     super.onopen(db);     if (!db.isreadonly()) {              db.execsql("pragma foreign_keys=on;");     } } 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -