mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-10-29 08:03:05 +00:00
OneToMany fixes
This commit is contained in:
1 parent
c3156f2e41
commit
261d8827e3
2 files changed
+15
No files matched your search
+11
@@ -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