android.database.sqlite.SQLiteOpenHelper
provides the ability to use an in-memory database if the name argument to its constructor is null
:
String: of the database file, or null for an in-memory database
If SQLiteOpenHelper
is instantiated multiple times with a null
name argument, do they access the same in-memory database or is a separate in-memory database created each time?
From SQLite official documentation In-Memory Databases
Opening two database connections each with the filename ":memory:" will create two independent in-memory databases.
In Android, pass null instead of ":memory:"
So, If you instantiate SQLiteOpenHelper multiple times with a null name argument then it create separate in-memory database created each time
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With