Skip to content

//selekt-android/com.bloomberg.selekt.android/SQLiteOpenHelper/writableDatabase

writableDatabase

[androidJvm]\ open override val writableDatabase: SQLiteDatabase

Create and/or open a database that will be used for reading and writing. The first time this is called, the database will be opened and onCreate(SQLiteDatabase) and onUpgrade(SQLiteDatabase, int, int) or onDowngrade(SQLiteDatabase) can be called and each inside a transaction. If the transaction succeeds onOpen(SQLiteDatabase) is called.

Once opened successfully, the database is cached, so you can call this method every time you need to write to the database. (Make sure to call close() when you no longer need the database.) Errors such as bad permissions or a full disk may cause this method to fail, but future attempts may succeed if the problem is fixed.