diff options
author | Patrick Lang <72232737+patrickunterwegs@users.noreply.github.com> | 2022-05-31 20:17:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 20:17:02 +0300 |
commit | ce458e09259b1ead9c3bde9bf76dc66639df2bac (patch) | |
tree | 4279b527e41c5b93238c3422616fa6df14ceff96 | |
parent | 82c12e144856f3d1c4488790252720533b53fa39 (diff) |
Updated queryByUID to query independent of current collection (#37)
-rw-r--r-- | src/main/java/at/bitfire/ical4android/JtxCollection.kt | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/at/bitfire/ical4android/JtxCollection.kt b/src/main/java/at/bitfire/ical4android/JtxCollection.kt index 5eb5b1c..1527ef5 100644 --- a/src/main/java/at/bitfire/ical4android/JtxCollection.kt +++ b/src/main/java/at/bitfire/ical4android/JtxCollection.kt @@ -132,11 +132,12 @@ open class JtxCollection<out T: JtxICalObject>(val account: Account, } /** - * @param [UID] of the entry that should be retrieved as content values + * @param [uid] of the entry that should be retrieved as content values * @return Content Values of the found item with the given UID or null if the result was empty or more than 1 + * The query checks for the [uid] within all collections of this account, not only the current collection. */ fun queryByUID(uid: String): ContentValues? { - client.query(JtxContract.JtxICalObject.CONTENT_URI.asSyncAdapter(account), null, "${JtxContract.JtxICalObject.ICALOBJECT_COLLECTIONID} = ? AND ${JtxContract.JtxICalObject.UID} = ?", arrayOf(id.toString(), uid), null).use { cursor -> + client.query(JtxContract.JtxICalObject.CONTENT_URI.asSyncAdapter(account), null, "${JtxContract.JtxICalObject.UID} = ?", arrayOf(uid), null).use { cursor -> Ical4Android.log.fine("queryByUID: found ${cursor?.count} records in ${account.name}") if (cursor?.count != 1) return null |