I want to create a read-only memory-backed SQLite database to which I
"attach database" other SQLite db files. Usually I would use:
SQLiteDatabase.create(null)
to do this but, AFAICT this is writable because it uses
SQLiteDatabase.CREATE_IF_NECESSARY.
My current workaround is to create a db in internal storage:
File dbFile = new File(getDatabasePath("base.db"));
if (!dbFile.exists) {
openOrCreateDatabase(dbFile.getName(), MODE_PRIVATE,
null).close();
}
SQLiteDatabase sqldb = SQLiteDatabase.openDatabase(dbFile.getName(),
null, SQLiteDatabase.OPEN_READONLY);
In other words, to not use a memory-backed db at all.
Is there a better way?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en