mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-21 08:07:16 +00:00
OneToMany fixes
This commit is contained in:
parent
c3156f2e41
commit
261d8827e3
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## 0.5.11
|
## 0.5.11
|
||||||
|
|
||||||
|
* `Repos`:
|
||||||
|
* `Common`:
|
||||||
|
* Fixes in `WriteOneToManyRepo#add`
|
||||||
|
|
||||||
## 0.5.10
|
## 0.5.10
|
||||||
|
|
||||||
* `Versions`
|
* `Versions`
|
||||||
|
@ -55,6 +55,17 @@ class OneToManyAndroidRepo<Key, Value>(
|
|||||||
helper.blockingWritableTransaction {
|
helper.blockingWritableTransaction {
|
||||||
for ((k, values) in toAdd) {
|
for ((k, values) in toAdd) {
|
||||||
values.forEach { v ->
|
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(
|
insert(
|
||||||
tableName,
|
tableName,
|
||||||
null,
|
null,
|
||||||
|
Loading…
Reference in New Issue
Block a user