/WCDBRoomX

WCDB with New Room!

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

[Deprecated]WCDBRoomX

Based on our tests, the latest version of sqlcipher-android now outperforms WCDB 1.x. Therefore, we're no longer updating this project. We encourage you to switch over to the native SQLCipher.

Feature

  • Adapt WCDB to work with the latest version of Room
  • Include support for the @Upsert annotation
  • Ensure compatibility with the latest version of SQLCipher
  • Migrate dependencies to AndroidX

Usage

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle or settings.gradle at the end of repositories:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

For *.kts :

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { setUrl("https://jitpack.io") }
    }
}

Step 2. Add the dependency

These dependencies are no longer needed:

//    implementation("androidx.sqlite:sqlite-ktx:2.4.0")
//    implementation("net.zetetic:sqlcipher-android:4.5.6@aar")
//    implementation("com.tencent.wcdb:wcdb-android:1.1-19")

Just add WCDBRoomX in your app build.gradle :

dependencies {
    implementation 'com.github.ysy950803:WCDBRoomX:1.0.2'
}

For *.kts :

dependencies {
    implementation("com.github.ysy950803:WCDBRoomX:1.0.2")
}

Sample

See app/src/main/java/com/ysy/wcdbroomx/AppDatabase.kt

WCDBRoomX does not include the Room library. You should add the dependency of Room by yourself:

plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    id("com.google.devtools.ksp")
}

val roomVersion = "2.6.1"
ksp("androidx.room:room-compiler:$roomVersion")
implementation("androidx.room:room-ktx:$roomVersion")

So easy to use WCDB with Room:

Room.databaseBuilder(...)
    .openHelperFactory(WCDBRoomX.createOpenHelperFactory("db_password"))
    .build()