1

I would like to use this library only for generating sql without executing it. Can you please let me see good example how can i use SQLSytax in order just to generate. for example :

val query:String = //Use SQLSyntax

println(query)

res1: select * from TABLE where A = ?

val bindedParameters:List[String] = ....

David H
  • 1,346
  • 3
  • 16
  • 29
  • if you use Slick, you can create a query there and access its selectStatement (or other kinds of statements) without executing it. – Ashalynd Oct 02 '14 at 13:57

1 Answers1

1

You can use #statement and #parameters like this.

scala> val q = sql"select * from users where id = ${123}"
q: scalikejdbc.SQL[Nothing,scalikejdbc.NoExtractor] = scalikejdbc.SQLToTraversableImpl@37157995

scala> q.statement
res0: String = select * from users where id = ?

scala> q.parameters
res1: Seq[Any] = List(123)
Kazuhiro Sera
  • 1,822
  • 12
  • 15