I tried to use the interpolation in a query that contains two IN clauses and fails whereas having a single IN clause works.
Example of query:
val field1List: List[String] = List("a", "b")
val field2List: List[Int] = List(2, 3)
val startDate: String = ???
val endDate: String = ???
sql"""SELECT group_id, count(*) as my_count
FROM my_table
WHERE date >= $startDate AND date < $endDate
AND field1 IN ($field1List)
AND field2 IN ($field2List)
GROUP BY group_id"""
.query[(Long, Long)]
.selectAll
The error I get is:
Parameter "#6" is not set; SQL statement:
SELECT group_id, count(*) as my_count
FROM my_table
WHERE date >= ? AND date < ?
AND field1 IN (?, ?)
AND field2 IN (?, ?)
GROUP BY group_id [90012-220]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:658)
Follow-up issue of https://github.com/zio/zio-jdbc/issues/104 solved in v0.1.0.
I tried to use the interpolation in a query that contains two
IN
clauses and fails whereas having a singleIN
clause works.Example of query:
The error I get is:
If I remove one of the
IN
clauses, it does work.