Sets an array parameter on statement.
Sets an array parameter on statement.
java.sql.Array
SQL("INSERT INTO Table(arr) VALUES {a}").on("a" -> Array("A", "2", "C"))
Sets a binary stream as parameter on statement.
Sets a binary stream as parameter on statement.
For null
value, setNull
with LONGVARBINARY
is called on statement.
SQL("INSERT INTO Table(bin) VALUES {b}").on("b" -> inputStream)
Sets a blob as parameter on statement.
Sets a blob as parameter on statement.
For null
value, setNull
with BLOB
is called on statement.
val blob = con.createBlob() blob.setBytes(1, byteArray) SQL("INSERT INTO Table(bin) VALUES {b}").on("b" -> blob)
Sets boolean value on statement.
Sets an array of byte as parameter on statement.
Sets byte value on statement.
Sets character as parameter value.
Sets a character stream as parameter on statement.
Sets a character stream as parameter on statement.
For null
value, setNull
with VARCHAR
is called on statement.
SQL("INSERT INTO Table(chars) VALUES {c}").on("c" -> reader)
Sets Java Character as parameter value.
Sets date as statement parameter.
Sets double value on statement.
Sets float value on statement.
Sets Id parameter on statement.
Sets Id parameter on statement.
SQL("INSERT INTO tbl(id, name) VALUES ({i}, {v}"). on("i" -> anorm.Id("id"), "v" -> "name")
Sets a temporal instant on statement.
Sets a temporal instant on statement.
import java.time.Instant import anorm.Java8._ SQL("SELECT * FROM Test WHERE time < {b}").on('b -> Instant.now)
Sets integer value on statement.
Sets Java Integer object on statement.
Sets Java big decimal on statement.
Sets Java big integer on statement.
Sets Java Boolean object on statement.
Sets Java Byte object on statement.
Sets Java Double object on statement.
Sets Java Float object on statement.
Sets Java Long object on statement.
Sets Java Short object on statement.
Sets joda-time DateTime as statement parameter.
Sets joda-time DateTime as statement parameter.
For null
value, setNull
with TIMESTAMP
is called on statement.
import org.joda.time.DateTime SQL("UPDATE tbl SET modified = {d}").on('d -> new DateTime())
Sets joda-time Instant as statement parameter.
Sets joda-time Instant as statement parameter.
For null
value, setNull
with TIMESTAMP
is called on statement.
import org.joda.time.Instant SQL("UPDATE tbl SET modified = {d}").on('d -> new Instant())
Sets multi-value parameter from list on statement.
Sets multi-value parameter from list on statement.
SQL("SELECT * FROM Test WHERE cat IN ({categories})"). on('categories -> List(1, 3, 4)
Sets a local date/time on statement.
Sets a local date/time on statement.
import java.time.LocalDateTime import anorm.Java8._ SQL("SELECT * FROM Test WHERE time < {b}").on('b -> LocalDateTime.now)
Sets long value on statement.
Sets null for not assigned value.
Sets opaque value as statement parameter.
Sets optional A inferred as Option[A].
Sets optional A inferred as Option[A].
SQL("SELECT * FROM Test WHERE category = {c}").on('c -> Option("cat")) SQL"SELECT * FROM Test WHERE nullable_int = \${Option.empty[Int]}"
Sets big decimal on statement.
Sets big integer on statement.
Sets multi-value parameter on statement, with custom formatting (using anorm.SeqParameter).
Sets multi-value parameter on statement, with custom formatting (using anorm.SeqParameter).
import anorm.SeqParameter SQL("SELECT * FROM Test t WHERE {categories}"). on('categories -> SeqParameter( values = Seq("a", "b", "c"), separator = " OR ", pre = "EXISTS (SELECT NULL FROM j WHERE t.id=j.id AND name=", post = ")"))
Sets multi-value parameter from sequence on statement.
Sets multi-value parameter from sequence on statement.
SQL("SELECT * FROM Test WHERE cat IN ({categories})"). on('categories -> Seq("a", "b", "c")
Sets multi-value parameter from set on statement.
Sets multi-value parameter from set on statement.
SQL("SELECT * FROM Test WHERE cat IN ({categories})"). on('categories -> Set(1, 3, 4)
Sets short value on statement.
Sets not empty optional A inferred as Some[A].
Sets not empty optional A inferred as Some[A].
SQL("SELECT * FROM Test WHERE category = {c}").on('c -> Some("cat"))
Sets multi-value parameter from sorted set on statement.
Sets multi-value parameter from sorted set on statement.
SQL("SELECT * FROM Test WHERE cat IN ({categories})"). on('categories -> SortedSet("a", "b", "c")
Sets multi-value parameter from stream on statement.
Sets multi-value parameter from stream on statement.
SQL("SELECT * FROM Test WHERE cat IN ({categories})"). on('categories -> Stream(1, 3, 4)
Sets string as parameter value.
Sets timestamp as statement parameter.
Sets a wrapped timestamp as statement parameter.
Sets a wrapped timestamp as statement parameter.
For null
value, setNull
with TIMESTAMP
is called on statement.
val wrapper = new { // Any value with a `.getTimestamp` val getTimestamp = new java.sql.Timestamp(123L) } SQL("UPDATE tbl SET modified = {ts}").on('ts -> wrapper)
Sets UUID as statement parameter.
Sets multi-value parameter from vector on statement.
Sets multi-value parameter from vector on statement.
SQL("SELECT * FROM Test WHERE cat IN ({categories})"). on('categories -> Vector("a", "b", "c")
Sets a zoned date/time on statement.
Sets a zoned date/time on statement.
import java.time.ZonedDateTime import anorm.Java8._ SQL("SELECT * FROM Test WHERE time < {b}").on('b -> ZonedDateTime.now)
Sets null for None value.
Provided conversions to set statement parameter.