What is the difference between inSet and inSetBind in Slick

Mike picture Mike · Oct 27, 2014 · Viewed 8.5k times · Source

The ScalaDoc of the functions has not been filled out.

I know that the methods are used for mimicking SQL's IN keyword (eg, SELECT * FROM table WHERE id IN VALUES(1, 42, 101) could be done with table.filter(_.id inSet Seq(1, 42, 101))). I don't know what this "bind" version is or how to choose which I should be using.

Answer

virtualeyes picture virtualeyes · Oct 27, 2014

inSet is an unsafe version of inSetBind which generates a safe/escaped sql value based on passed in input. In your example where the value is manually set, the two types of bind are equally safe.

Normally with bound parameters you get a performance boost (via generated prepared statement), but not the case with collection values. See here for the details.