trait Statement extends AnyRef
Represent a SQL statement
Methods of this trait allow to bind argument values to parameters
either by name or index. Classes extending this trait can be used
as an alternative to sql
string interpolator - SqlInterpolator.
- Grouped
- Alphabetic
- By Inheritance
- Statement
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
bind(args: (String, Any)*): ExecutableStatement
Binds each parameter by name.
Binds each parameter by name.
Example:
val insert = conn.insert("insert into table(p1, p2) values (:p1, :p2)") insert.map(_.bind("p1" -> "str", "p2" -> 10L)).foreach(_.execute())
Throws:
- MissingParamValException when some parameter value was not provided
- NoSuitableConverterFoundException when some parameter value's type is not convertible to a database type
-
abstract
def
bindByIdx(args: Any*): ExecutableStatement
Binds each parameter by index.
Binds each parameter by index.
Parameters are ordered, each value in
params
sequence will be bound to the corresponding parameter.Example:
val insert = conn.insert("insert into table(p1, p2) values (:p1, :p2)") insert.map(_.bind("str", 10L)).foreach(_.execute())
Throws:
- MissingParamValException when some parameter value was not provided
- NoSuitableConverterFoundException when some parameter value's type is not convertible to a database type
-
abstract
def
bindByIdxF(args: Any*): Future[ExecutableStatement]
Binds each parameter by index and wraps a result in a Future.
Binds each parameter by index and wraps a result in a Future.
Parameters are ordered, each value in
params
sequence will be bound to the corresponding parameter.This is not an asynchronous operation, it's only an utility method that wraps
bindByIdx
result with a Future to allow chaining bind operations with asynchronous operations.Example:
for { insert <- conn.insert("insert into table(p1, p2) values (:p1, :p2)") bound <- insert.bindByIdxF("str", 10L) _ <- bound.execute() } yield ()
Resulting future can fail with:
- MissingParamValException when some parameter value was not provided
- NoSuitableConverterFoundException when some parameter value's type is not convertible to a database type
-
abstract
def
bindF(args: (String, Any)*): Future[ExecutableStatement]
Binds each parameter by name and wraps a result in a Future.
Binds each parameter by name and wraps a result in a Future.
This is not an asynchronous operation, it's only an utility method that wraps
bind
result with a Future to allow chaining bind operations with asynchronous operations.Example:
for { insert <- conn.insert("insert into table(p1, p2) values (:p1, :p2)") bound <- insert.bindF("p1" -> "str", "p2" -> 10L) _ <- bound.execute() } yield ()
Resulting future can fail with:
- MissingParamValException when some parameter value was not provided
- NoSuitableConverterFoundException when some parameter value's type is not convertible to a database type
-
abstract
def
noParams: ExecutableStatement
Creaes an executable version of the statement object without providing any parameters.
Creaes an executable version of the statement object without providing any parameters.
Example:
val insert = conn.statement("insert into table(p1, p2) values ('str', 10)") insert.map(_.noParams).foreach(_.execute())
-
abstract
def
noParamsF: Future[ExecutableStatement]
Creates an executable version of the statement object without providing any parameters and wraps a result in a future
Creates an executable version of the statement object without providing any parameters and wraps a result in a future
This is not an asynchronous operation, it's only an utility method that wraps
noParams
result with a Future to allow chaining bind operations with asynchronous operations.Example:
for { insert <- conn.statement("insert into table(p1, p2) values ('str', 10)") executable <- insert.noParamsF _ <- bound.execute() } yield ()
-
abstract
def
streamParams(paramsPublisher: Publisher[Map[String, Any]]): Future[Unit]
Streams statement parameters to a database.
Streams statement parameters to a database.
This method can be used to repeatedly execute this statement with published parameters by leveraging Reactive Streams specification's
Publisher
with a backpressure. Each published element is a map containing all parameters required by this statement.Resulting future can fail with:
- MissingParamValException when some parameter value was not provided
- NoSuitableConverterFoundException when some parameter value's type is not convertible to a database type
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (Statement, B)
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- def ensuring(cond: (Statement) ⇒ Boolean, msg: ⇒ Any): Statement
- def ensuring(cond: (Statement) ⇒ Boolean): Statement
- def ensuring(cond: Boolean, msg: ⇒ Any): Statement
- def ensuring(cond: Boolean): Statement
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def formatted(fmtstr: String): String
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- def →[B](y: B): (Statement, B)
TODO