Skip to content

Nullable list in where statement #5160

Discussion options

You must be logged in to vote

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

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@chason-choate-trilliant
Comment options

@vanniktech
Comment options

Answer selected by chason-choate-trilliant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants