Search code examples
androidsqlbritesqldelight

How to use new compiled statements in sqldelight with sqlbrite?


Since I cannot obtain SQLiteOpenHelper instance from BriteDatabase, how can I create compiled insert/update/delete statement from my model? Methods that return SqlDelightStatement are marked as deprecated in SqlDelight 0.5.1. I'm using SqlBrite 0.8.0 and I see there's a BriteDatabase#executeInsert(String, SQLiteStatement) and so on.


Solution

  • EDIT December 27th 2016: SQLBrite version 1.1.0 and up now exposes its own getWritableDatabase()

    It's worth noting that calling getWritableDatabase() can potentially create or migrate a database so make sure you're calling it from a background thread!