Sanitize' String'争论与Anorm?

时间:2016-07-13 20:44:59

标签: scala anorm

假设:

def unsafeF(x: String): String = 
   s"select * from TABLE WHERE x = $x"

是否可以通过unsafeFx的函数调用来清理x的输入$x

1 个答案:

答案 0 :(得分:1)

只要你使用正确的Anorm字符串插值而不是标准的插值,就没有必要对它进行消毒。

SQL"select * from TABLE WHERE x = $x"
  

您可以在Anorm documentation中看到Anorm插值。