Packages

t

anorm

ToStatementPriority0

sealed trait ToStatementPriority0 extends AnyRef

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ToStatementPriority0
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. implicit def arrayToParameter[A <: AnyRef](implicit m: ParameterMetaData[A]): ToStatement[Array[A]]

    Sets an array parameter on statement (see java.sql.Array).

    Sets an array parameter on statement (see java.sql.Array).

    import anorm._
    
    SQL("INSERT INTO Table(arr) VALUES {a}").
      on("a" -> Array("A", "2", "C"))
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. implicit def binaryStreamToStatement[S <: InputStream]: ToStatement[S]

    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.

    // skip-doc-5f98a5e
    import anorm._
    
    def foo(inputStream: java.io.InputStream) =
      SQL("INSERT INTO Table(bin) VALUES {b}").on("b" -> inputStream)
  7. implicit def blobToStatement[B <: Blob]: ToStatement[B]

    Sets a blob as parameter on statement.

    Sets a blob as parameter on statement. For null value, setNull with BLOB is called on statement.

    // skip-doc-5f98a5e
    import anorm._
    
    def foo(byteArray: Array[Byte])(implicit con: java.sql.Connection) = {
      val blob = con.createBlob()
      blob.setBytes(1, byteArray)
    
      SQL("INSERT INTO Table(bin) VALUES {b}").on("b" -> blob)
    }
  8. implicit def characterStreamToStatement[R <: Reader]: ToStatement[R]

    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.

    // skip-doc-5f98a5e
    import anorm._
    
    def foo(reader: java.io.Reader) =
      SQL("INSERT INTO Table(chars) VALUES {c}").on("c" -> reader)
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. implicit def listToStatement[A](implicit c: ToStatement[A]): ToStatement[List[A]]

    Sets multi-value parameter from list on statement.

    Sets multi-value parameter from list on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE cat IN ({categories})").
      on("categories" -> List(1, 3, 4))
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. implicit def optionToStatement[A](implicit c: ToStatement[A], meta: ParameterMetaData[A]): ToStatement[Option[A]]

    Sets optional A inferred as Option[A].

    Sets optional A inferred as Option[A].

    import anorm._
    
    SQL("SELECT * FROM Test WHERE category = {c}").on("c" -> Option("cat"))
    SQL"SELECT * FROM Test WHERE nullable_int = \${Option.empty[Int]}"
  21. implicit def seqParamToStatement[A](implicit c: ToStatement[Seq[A]]): ToStatement[SeqParameter[A]]

    Sets multi-value parameter on statement, with custom formatting (using SeqParameter).

    Sets multi-value parameter on statement, with custom formatting (using SeqParameter).

    import anorm._
    
    SQL("SELECT * FROM Test t WHERE {categories}").
      on("categories" -> SeqParameter(
        seq = Seq("a", "b", "c"), sep = " OR ",
        pre = "EXISTS (SELECT NULL FROM j WHERE t.id=j.id AND name=",
        post = ")"))
  22. implicit def seqToStatement[A](implicit c: ToStatement[A]): ToStatement[Seq[A]]

    Sets multi-value parameter from sequence on statement.

    Sets multi-value parameter from sequence on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE cat IN ({categories})").
      on("categories" -> Seq("a", "b", "c"))
  23. implicit def setToStatement[A](implicit c: ToStatement[A]): ToStatement[Set[A]]

    Sets multi-value parameter from set on statement.

    Sets multi-value parameter from set on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE cat IN ({categories})").
      on("categories" -> Set(1, 3, 4))
  24. implicit def someToStatement[A](implicit c: ToStatement[A]): ToStatement[Some[A]]

    Sets not empty optional A inferred as Some[A].

    Sets not empty optional A inferred as Some[A].

    import anorm._
    
    SQL("SELECT * FROM Test WHERE category = {c}").on("c" -> Some("cat"))
  25. implicit def sortedSetToStatement[A](implicit c: ToStatement[A]): ToStatement[SortedSet[A]]

    Sets multi-value parameter from sorted set on statement.

    Sets multi-value parameter from sorted set on statement.

    import scala.collection.immutable.SortedSet
    
    import anorm._
    
    SQL("SELECT * FROM Test WHERE cat IN ({categories})").
      on("categories" -> SortedSet("a", "b", "c"))
  26. implicit def streamToStatement[A](implicit c: ToStatement[A]): ToStatement[LazyLst[A]]

    Sets multi-value parameter from stream on statement.

  27. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  28. implicit def timestampWrapper1ToStatement[T <: TimestampWrapper1]: ToStatement[T]

    Sets a wrapped timestamp as statement parameter.

    Sets a wrapped timestamp as statement parameter. For null value, setNull with TIMESTAMP is called on statement.

    // skip-doc-5f98a5e
    import anorm._
    
    val wrapper = new {
      // Any value with a `.getTimestamp`
      val getTimestamp = new java.sql.Timestamp(123L)
    }
    
    SQL("UPDATE tbl SET modified = {ts}").on("ts" -> wrapper)
  29. def toString(): String
    Definition Classes
    AnyRef → Any
  30. implicit def vectorToStatement[A](implicit c: ToStatement[A]): ToStatement[Vector[A]]

    Sets multi-value parameter from vector on statement.

    Sets multi-value parameter from vector on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE cat IN ({categories})").
      on("categories" -> Vector("a", "b", "c"))
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  34. implicit object booleanToStatement extends ToStatement[Boolean]

    Sets boolean value on statement.

    Sets boolean value on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE enabled = {b}").on("b" -> true)
  35. implicit object byteToStatement extends ToStatement[Byte]

    Sets byte value on statement.

    Sets byte value on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").on("b" -> 1.toByte)
  36. implicit object charToStatement extends ToStatement[Char]

    Sets character as parameter value.

    Sets character as parameter value.

    import anorm._
    
    SQL("SELECT * FROM tbl WHERE flag = {c}").on("c" -> 'f')
  37. implicit object characterToStatement extends ToStatement[Character]

    Sets Java Character as parameter value.

    Sets Java Character as parameter value. For null character, setNull with VARCHAR is called on statement.

    import anorm._
    
    SQL("SELECT * FROM tbl WHERE flag = {c}").
      on("c" -> new java.lang.Character('f'))
  38. implicit object dateToStatement extends ToStatement[Date]

    Sets date as statement parameter.

    Sets date as statement parameter. For null value, setNull with TIMESTAMP is called on statement.

    import anorm._
    
    SQL("UPDATE tbl SET modified = {d}").on("d" -> new java.util.Date())
  39. implicit object doubleToStatement extends ToStatement[Double]

    Sets double value on statement.

    Sets double value on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").on("b" -> 1D)
  40. implicit object floatToStatement extends ToStatement[Float]

    Sets float value on statement.

    Sets float value on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").on("b" -> 1F)
  41. implicit object intToStatement extends ToStatement[Int]

    Sets integer value on statement.

    Sets integer value on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").on("b" -> 1)
  42. implicit object integerToStatement extends ToStatement[Integer]

    Sets Java Integer object on statement.

    Sets Java Integer object on statement. For null value, setNull with INTEGER is called on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").
      on("b" -> new java.lang.Integer(1))
  43. implicit object javaBigDecimalToStatement extends ToStatement[BigDecimal]

    Sets Java big decimal on statement.

    Sets Java big decimal on statement. Value null is accepted.

    import anorm._
    
    SQL("UPDATE tbl SET max = {m}").
      on("m" -> new java.math.BigDecimal(10.02F))
  44. implicit object javaBigIntegerToStatement extends ToStatement[BigInteger]

    Sets Java big integer on statement.

    Sets Java big integer on statement. For null value, setNull with NUMERIC is called on statement.

    import anorm._
    
    SQL("UPDATE tbl SET max = {m}").
      on("m" -> new java.math.BigInteger("15"))
  45. implicit object javaBooleanToStatement extends ToStatement[Boolean]

    Sets Java Boolean object on statement.

    Sets Java Boolean object on statement. For null value, setNull with BOOLEAN is called on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE enabled = {b}").
      on("b" -> java.lang.Boolean.TRUE)
  46. implicit object javaByteToStatement extends ToStatement[Byte]

    Sets Java Byte object on statement.

    Sets Java Byte object on statement. For null value, setNull with TINYINT is called on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").
      on("b" -> new java.lang.Byte(1: Byte))
  47. implicit object javaDoubleToStatement extends ToStatement[Double]

    Sets Java Double object on statement.

    Sets Java Double object on statement. For null value, setNull with DOUBLE is called on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").
      on("b" -> new java.lang.Double(1D))
  48. implicit object javaFloatToStatement extends ToStatement[Float]

    Sets Java Float object on statement.

    Sets Java Float object on statement. For null value, setNull with FLOAT is called on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").
      on("b" -> new java.lang.Float(1F))
  49. implicit object javaLongToStatement extends ToStatement[Long]

    Sets Java Long object on statement.

    Sets Java Long object on statement. For null value, setNull with BIGINT is called on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").
      on("b" -> new java.lang.Long(1L))
  50. implicit object javaShortToStatement extends ToStatement[Short]

    Sets Java Short object on statement.

    Sets Java Short object on statement. For null value, setNull with SMALLINT is called on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").
      on("b" -> new java.lang.Short(1.toShort))
  51. implicit object longToStatement extends ToStatement[Long]

    Sets long value on statement.

    Sets long value on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").on("b" -> 1L)
  52. implicit object objectToStatement extends ToStatement[Object]

    Sets opaque value as statement parameter.

    Sets opaque value as statement parameter. UNSAFE: It's set using java.sql.PreparedStatement.setObject.

    import anorm._
    
    SQL("EXEC indexed_at {d}").
      on("d" -> anorm.Object(new java.util.Date()))
  53. implicit object scalaBigDecimalToStatement extends ToStatement[BigDecimal]

    Sets big decimal on statement.

    Sets big decimal on statement. For null value, setNull with DECIMAL is called on statement.

    import anorm._
    
    SQL("UPDATE tbl SET max = {m}").on("m" -> BigDecimal(10.02F))
  54. implicit object scalaBigIntegerToStatement extends ToStatement[BigInt]

    Sets big integer on statement.

    Sets big integer on statement. For null value, setNull with NUMERIC is called on statement.

    import anorm._
    
    SQL("UPDATE tbl SET max = {m}").on("m" -> BigInt(15))
  55. implicit object shortToStatement extends ToStatement[Short]

    Sets short value on statement.

    Sets short value on statement.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE flag = {b}").on("b" -> 1.toShort)
  56. implicit object stringToStatement extends ToStatement[String]

    Sets string as parameter value.

    Sets string as parameter value. Value null is accepted.

    import anorm._
    
    SQL("SELECT * FROM tbl WHERE name = {n}").on("n" -> "str")
  57. implicit object timestampToStatement extends ToStatement[Timestamp]

    Sets timestamp as statement parameter.

    Sets timestamp as statement parameter. Value null is accepted.

    import anorm._
    
    def foo(date: java.util.Date) =
      SQL("UPDATE tbl SET modified = {ts}").
        on("ts" -> new java.sql.Timestamp(date.getTime))
  58. implicit object uriToStatement extends ToStatement[URI]

    Sets URI as statement parameter.

    Sets URI as statement parameter. For null value, setNull with VARCHAR is called on statement.

    import anorm._
    
    SQL("INSERT INTO lang_tbl(id, name) VALUE ({i}, {n})").
      on("i" -> new java.net.URI("https://github.com/playframework/"),
         "n" -> "lang")
  59. implicit object urlToStatement extends ToStatement[URL]

    Sets URL as statement parameter.

    Sets URL as statement parameter. For null value, setNull with VARCHAR is called on statement.

    import anorm._
    
    SQL("INSERT INTO lang_tbl(id, name) VALUE ({i}, {n})").
      on("i" -> new java.net.URL("https://github.com/playframework/"),
         "n" -> "lang")
  60. implicit object uuidToStatement extends ToStatement[UUID]

    Sets UUID as statement parameter.

    Sets UUID as statement parameter. For null value, setNull with VARCHAR is called on statement.

    import anorm._
    
    SQL("INSERT INTO lang_tbl(id, name) VALUE ({i}, {n})").
      on("i" -> java.util.UUID.randomUUID(), "n" -> "lang")

Deprecated Value Members

  1. implicit object noneToStatement extends ToStatement[None.type]

    Sets null for None value.

    Sets null for None value.

    import anorm._
    
    SQL("SELECT * FROM Test WHERE category = {c}").on("c" -> None)
    
    // Rather use:
    anorm.SQL("SELECT * FROM Test WHERE category = {c}").
      on("c" -> Option.empty[String]) // Not deprecated
    Annotations
    @deprecated
    Deprecated

    (Since version 2.3.7) Parameter value should be passed using Option.empty[T]

Inherited from AnyRef

Inherited from Any

Ungrouped