Advertisement
Guest User

Untitled

a guest
Jul 17th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.62 KB | None | 0 0
  1.   def idCriteria(r:Tbl1Table, ids:Map[Int, List[(Int, Int)]]):Column[Boolean] = ids.headOption match {
  2.     case None => false
  3.     case Some(e) =>
  4.       val itemIds = e._2.map(_._2)
  5.       val grpId:Int = e._1
  6.       (((r.gid === grpId) && (r.item inSet itemIds)) || idCriteria(r, ids - e._1))
  7.   }
  8.  
  9.   val correct = query.filter(r => idCriteria(r, idsGrp))
  10.   println(s"select is ${correct.selectStatement}")
  11.   //prints: select is select x2."id", x2."gid", x2."item" from "TBL1" x2
  12.   //        where ((x2."gid" = 205) and (x2."item" in (19))) or
  13.   //              (((x2."gid" = 204) and (x2."item" in (11, 12, 13))) or (0 = 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement