mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-07-20 17:27:52 +00:00
OneToMany fixes
This commit is contained in:
CHANGELOG.md
repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/onetomany
@ -2,6 +2,10 @@
|
||||
|
||||
## 0.5.11
|
||||
|
||||
* `Repos`:
|
||||
* `Common`:
|
||||
* Fixes in `WriteOneToManyRepo#add`
|
||||
|
||||
## 0.5.10
|
||||
|
||||
* `Versions`
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user