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

Đang mở
#23 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
android, java, sqlite
Lĩnh vực
database, mobile

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Java
Star
277
Fork
38
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sqlcipher/sqlcipher-android

Tất cả issue của sqlcipher/sqlcipher-android

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.