Using scala 2.11.1 on play framework 2.3.
Because Anorm didn't support multi-value parameters in previous versions I used David's workaround. Anorm now supports multi-value parameters and I started removing the workaround and using Anorm multi-value parameters.
The example [sic] mentioned:
// With default formatting (", " as separator)
SQL("SELECT * FROM Test WHERE cat IN ({categories})").
on('categories -> Seq("a", "b", "c")
// -> SELECT * FROM Test WHERE cat IN ('a', 'b', 'c')
Yet my code:
val names = List("Able", "Baker", "Charlie") // Passed as a parameter to my method!
val result =
SQL( """
SELECT city
FROM addresses
WHERE name IN ({names});
""" ).on( 'names -> names ).as( scalar[String] * )
gives me this error:
type mismatch;
found : (Symbol, List[String])
required: anorm.NamedParameter
or
type mismatch;
found : (Symbol, scala.collection.immutable.Seq[String])
required: anorm.NamedParameter
depending if i try a list or sequence (or one of the suggestions to map it).
I'm no expert, by far, and I think it's missing some implicit conversion? Clueless to find out how/what/where. Tips/suggestions/solutions welcome!