sqlcipher / sqlcipher/sqlcipher-android
net.zetetic.database.sqlcipher.SQLiteConstraintException thrown if @Upsert is used
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 277
- Forks
- 38
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I have implemented the sqlcipher-android in this commit:
https://github.com/PrimalHQ/primal-android-app/commit/4bc4482565e6c0941ca859faae21822e8a347d3d
If I run clean install build I'm getting:
net.zetetic.database.sqlcipher.SQLiteConstraintException: UNIQUE constraint failed: ProfileData.ownerId (code 1555)
at net.zetetic.database.sqlcipher.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
at net.zetetic.database.sqlcipher.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:815)
at net.zetetic.database.sqlcipher.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:823)
at net.zetetic.database.sqlcipher.SQLiteStatement.executeInsert(SQLiteStatement.java:113)
at androidx.room.EntityInsertionAdapter.insert(EntityInsertionAdapter.kt:51)
at androidx.room.EntityUpsertionAdapter.upsert(EntityUpsertionAdapter.kt:91)
at net.primal.android.profile.db.ProfileDataDao_Impl.upsertAll(ProfileDataDao_Impl.java:165)
.....
It turns out that @Upsert is the cause of the crash. If we replace it with @Insert(onConflict = OnConflictStrategy.REPLACE) everything works fine. https://github.com/PrimalHQ/primal-android-app/commit/a46232a1f390f9d0418b4f6189d6ed1d1646d5dc
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Start by comparing the sqlcipher-android integration commit with the working commit linked in the issue, then trace the reported failure through Room's EntityUpsertionAdapter and SQLCipher's SQLiteConnection. Reproduce the clean-install failure and determine why @Upsert triggers the UNIQUE constraint; done means the upsert succeeds without requiring the @Insert replacement.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- android, java, sqlite
- Bereich
- database, mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 30/100