Advertisement
Guest User

Untitled

a guest
Aug 9th, 2014
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.89 KB | None | 0 0
  1. Execution exception
  2.  
  3.  
  4. [MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nulls last limit 10 offset 0' at line 1]
  5.  
  6. def list(page: Int = 0, pageSize: Int = 10, orderBy: Int = 1, filter: String = "%"): Page[(Computer, Option[Company])] = {
  7.    
  8.    val offest = pageSize * page
  9.    
  10.    DB.withConnection { implicit connection =>
  11.      
  12.      val computers = SQL(
  13.        """
  14.          select * from computer
  15.          left join company on computer.company_id = company.id
  16.          where computer.name like {filter}
  17.          order by {orderBy} nulls last
  18.          limit {pageSize} offset {offset}
  19.        """
  20.      ).on(
  21.        'pageSize -> pageSize,
  22.         'offset -> offest,
  23.         'filter -> filter,
  24.         'orderBy -> orderBy
  25.       ).as(Computer.withCompany *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement