sqlcipher / sqlcipher/sqlcipher-android
net.zetetic.database.sqlcipher.SQLiteConstraintException thrown if @Upsert is used
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 277
- Fork
- 38
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- android, java, sqlite
- Ambito
- database, mobile
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 30/100