Skip to content

Sql Cipher for Android  #590

@nandavenkat

Description

@nandavenkat

We are using Zetatic Version 4.5.0 with RoomDB Kotlin Android , Our Database taking 4 seconds to execute very simple query like SELECT * FROM TABLE ( this table have only one record)
is there any way to improve this? here is our implementation

fun provideDatabase(context: Context): AppDatabase {

        Room.databaseBuilder(
            context.applicationContext,
            AppDatabase::class.java, DB_ENCRYPTED
        )
            .openHelperFactory(getSupportFactory())
            .addMigrations(MIGRATION_X_Y)
            .fallbackToDestructiveMigration()
            .build()
   }
   
   

private fun getSupportFactory(): SupportFactory {
  val passPhrase: ByteArray = SQLiteDatabase.getBytes(DB_PASSPHRASE.toCharArray())
  val hook = object : SQLiteDatabaseHook {
      override fun preKey(database: SQLiteDatabase?) {}

      override fun postKey(database: SQLiteDatabase?) {
          database?.rawExecSQL("PRAGMA key = '$DB_PASSPHRASE';")
          database?.rawExecSQL("PRAGMA cipher_migrate;")
      }
  }
  return SupportFactory(passPhrase, hook)

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions