How to configure SQL language injection in Scala/Anorm?
已回答
I'm using Leda IU 122.29 with Scala plugin 0.6.77 and Play2 plugin 0.1.23.
In my Play project I use Anorm for persistence and in the DAO code there is a lot of code like this:
def findAll(): Seq[Membership] = {
DB.withConnection {
implicit connection =>
SQL("SELECT * FROM memberships").as(parser *)
}
}
I would like the Language Injection to detect that anorm.SQL(stmt:String) takes one string parameter which really is SQL.
I have tried to create a "generic Scala injection" in Preferences->Language Injection but I can't get it right and I haven't found any documentation that points me in the right direction when it comes to Scala injections.
帖子评论已关闭。
I'm using this places pattern which is working for me:
+ scalaLiteral().callArgument(0, psiMethod().withName("SQL").withParameters("java.lang.String"))
Hi,
I have the same problem and cannot make it work, even with the solution proposed.
I use both anorm SQL function and SQL implicit method for string interpolation. But none of them work with this pattern... :(
Hi.
Please raise a ticket with code example attached at https://youtrack.jetbrains.com/issues