net.zetetic.database.sqlcipher.SQLiteConstraintException thrown if @Upsert is used

オープン
#23 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
android, java, sqlite
領域
database, mobile

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Java
スター
277
フォーク
38
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sqlcipher/sqlcipher-android のほかの issue

sqlcipher/sqlcipher-android の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。