Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between inSet and inSetBind in Slick

Tags:

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.

like image 961
Mike Avatar asked Oct 26 '14 23:10

Mike


1 Answers

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.

like image 81
virtualeyes Avatar answered Sep 22 '22 14:09

virtualeyes