Android Room ORM: Support custom build of SQLite

为君一笑 提交于 2021-01-03 10:32:32

问题


I need to use a custom build of SQLite (based on sqlite.org version https://sqlite.org/android/doc/trunk/www/index.wiki) so that I can use custom FTS Tokenizers and to use SEE to encrypt my databases.

I'm using the following code to create a Room database:

val mainDb = Room.databaseBuilder(context, MainDatabase::class.java, "main")
                .openHelperFactory(SqliteOrgSQLiteOpenHelperFactory())
                .build()

I tried to implement my own "SupportSQLiteOpenHelper.Factory" (SqliteOrgSQLiteOpenHelperFactory) and tried to implement all of the needed classes, but there are too many direct dependencies to "android.database." and "android.database.sqlite.". All of these dependencies seem to need to be wrapped in "SupportXXX" classes

Example: SupportSQLiteOpenHelper.Configuration depends on:

  • android.database.DatabaseErrorHandler
  • android.database.DefaultDatabaseErrorHandler
  • android.database.sqlite.SQLiteDatabase.CursorFactory

SupportSQLiteDatabase depends on:

  • android.database.sqlite.SQLiteTransactionListener
  • android.database.sqlite.SQLiteDatabase.CursorFactory

Am I missing something? Am I approaching this all wrong?


回答1:


There is a github repo https://github.com/hannesa2/SafeRoom , based on attached zip from https://issuetracker.google.com/issues/38481640 which apply SQLCipher to Room



来源:https://stackoverflow.com/questions/44097662/android-room-orm-support-custom-build-of-sqlite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!