https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
s

Sean Proctor

02/28/2024, 5:38 PM
Is there a way to group multiple queries together as a
Query
in SQLDelight at runtime? I'm trying to add a list of values to a temp table before the query is run. The query is then used in a paging source, so it needs to be a
Query
.
a

alec

02/28/2024, 5:39 PM
yes:
Copy code
myQuery {
  INSERT INTO myTable...
  SELECT * FROM myTable...
}
instead of
myQuery:
s

Sean Proctor

02/28/2024, 5:44 PM
Is it possible to insert an arbitrarily-sized list like that?
a

alec

02/28/2024, 5:46 PM
should be fine
Copy code
myQuery {
  INSERT INTO myTable VALUES ?;
  SELECT * FROM myTable;
}
s

Sean Proctor

02/28/2024, 5:46 PM
I didn't know that. Thanks!
Table parameters are not usable in a grouped statement.
a

alec

02/28/2024, 5:58 PM
oh, neat
theres probably a good reason for that but i cant recall right now
s

Sean Proctor

02/28/2024, 5:59 PM
I guess it's pretty hard to generate because the following statement also takes some parameters?
2 Views