user2692684
user2692684

Reputation: 1

Play framework scala and mysql error

I have play framework(scala) working with mysql on my os ubuntu

I have example code

  val computers = SQL(
    """
      select * FROM 'computer'
      where 'computer.tytul' like {filter}
      order by {orderBy} nulls last
      limit {pageSize} offset {offset}
    """
  ).on(
    'pageSize -> pageSize, 
    'offset -> offest,
    'filter -> filter,
    'orderBy -> orderBy
  ).as(Computer.withCompany *)

That yields the following error when I use it with MySQL

[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 ''computer' where 'computer.tytul' like '%%' order by 2 nulls' at line 1]

That code was working with database in memory!
Can somebody help?

Upvotes: 0

Views: 520

Answers (1)

Joel Arnold
Joel Arnold

Reputation: 1231

I think it would work if you removed the quotes altogether (or use backticks, as suggested by Carsten).


Here is the doc: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html

Upvotes: 3

Related Questions