OneToMany fixes

This commit is contained in:
InsanusMokrassar 2021-06-16 13:19:59 +06:00
parent c3156f2e41
commit 261d8827e3
2 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,10 @@
## 0.5.11
* `Repos`:
* `Common`:
* Fixes in `WriteOneToManyRepo#add`
## 0.5.10
* `Versions`

View File

@ -55,6 +55,17 @@ class OneToManyAndroidRepo<Key, Value>(
helper.blockingWritableTransaction {
for ((k, values) in toAdd) {
values.forEach { v ->
val kAsString = k.keyAsString()
val vAsString = v.valueAsString()
val isThere = select(tableName,
null,
"$idColumnName=? AND $valueColumnName=?",
arrayOf(kAsString, vAsString),
limit = limitClause(1)
).use { it.moveToFirst() }
if (isThere) {
return@forEach
}
insert(
tableName,
null,