@Override
 public void onOpen(SQLiteDatabase db) {
   super.onOpen(db);
   if (!db.isReadOnly()) {
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
       db.setForeignKeyConstraintsEnabled(true);
     } else {
       db.execSQL("PRAGMA foreign_keys=ON");
     }
   }
 }
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
 private void setForeignKeyConstraintsEnabledPostJellyBean(SQLiteDatabase db) {
   db.setForeignKeyConstraintsEnabled(true);
 }
Ejemplo n.º 3
0
 @Override
 public void onConfigure(SQLiteDatabase db) {
   super.onConfigure(db);
   db.setForeignKeyConstraintsEnabled(true);
 }