Nullable list in where statement #5160
Answered
by
AlecKazakova
chason-choate-trilliant
asked this question in
Q&A
-
I'm struggling to find the correct way to do this. Any help would be appreciated. From Kotlin I want to be able to do the following: val incomingIDs: List<String>? = <could be a list or null>
myQueries.getResources(ids = incomingIDs) where the SQL is something like:
Is it possible to have a nullable list or should I look at creating a separate query for that case? |
Beta Was this translation helpful? Give feedback.
Answered by
AlecKazakova
Apr 17, 2024
Replies: 1 comment 2 replies
-
I'd recommend passing an additional parameter in and have something like val incomingIDs: List<String>? = <could be a list or null>
myQueries.getResources(matchIds = incomingIds != null, ids = incomingIDs ?: emptyList()) SELECT *
FROM table
WHERE :matchIds IS FALSE OR id IN :ids |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
chason-choate-trilliant
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd recommend passing an additional parameter in and have something like