Can anyone please give me a example for how to use like clause in scalikejdbc with dynamic value. I used following query but it did not work
sql"select * from tables_list where lower(TABLE_NAME) like '%$tableName.toLowerCase%'"
scalikejdbc build in prevent sql injection, therefore when you type like '%$tableName.toLowerCase%'
, it appear as like '%'urValue'%'
, hence error occur.
I found a way to go ground it, which is
def search(name:String){
val searchName = s"%$name%"
DB readOnly{ implicit session =>
sql"select * from db where name like $searchName".map
...
...
}
I hope this can help you.