package sapi
Provides a Scala API for database connectivity.
Main class is a Connection that can be obtained using a ConnectionFactory.
- Alphabetic
- By Inheritance
- sapi
- ImplicitsTrait
- SqlInterpolatorTrait
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
ColumnMetadata(name: String, dbTypeId: String) extends Product with Serializable
Represents metadata of a database column.
Represents metadata of a database column.
- name
column name
- dbTypeId
database vendor identifier of a datatype declared for the column
-
trait
Connection extends AnyRef
Represents a database connection (session).
Represents a database connection (session).
Instances of implementations of this trait can be obtained using a ConnectionFactory. When clients are done with the connection, they are required to call a
release
method co clean up resources such as open sockets.Invoking any method of this trait when any previous operation has not completed yet is not allowed. Operation is considered complete when a resulting Future completes.
Transaction management has to be done using
beginTx
,commitTx
androllbackTx
methods. Using SQL statements to manage transaction state is not allowed.SqlWithParams instances passed to
Connection
's methods can be created usingsql
string interpolator, for example:import io.rdbc.sapi._ val conn: Connection = ??? val login = "jdoe" conn.statement(sql"select * from users where login = $login").executeForStream()
Alternatively, when bare Strings are used as SQL statements, parameters are specified by name. Parameter name is an alphanumeric string starting with a letter, prefixed with a colon. Example:
import io.rdbc.sapi._ val conn: Connection = ??? val login = "jdoe" conn.statement(sql"select * from users where login = :login") .bind("login" -> login) .executable.executeForStream()
-
trait
ConnectionFactory extends AnyRef
Provides access to a database Connection.
Provides access to a database Connection.
Implementors must make the implementation of this trait thread-safe.
-
sealed
trait
DecimalNumber extends AnyRef
Unbounded decimal numeric type that extends BigDecimal to be able to represent NaN, positive infitnity and negative infinity.
- implicit class Duration2Timeout extends AnyRef
-
trait
ExecutableStatement extends AnyRef
Represents an executable statement.
Represents an executable statement.
Executable statement is a statement that has all parameters provided and is ready to be executed.
-
sealed
trait
KeyColumns extends AnyRef
Specification of columns that generate keys
-
class
ResultSet extends Traversable[Row]
Represents a set of rows returned by a database engine.
-
trait
Row extends AnyRef
Represents a row of a result returned by a database engine.
Represents a row of a result returned by a database engine.
This class defines a set of methods that can be used to get values from the row either by a column name or by a column index. Each method has a version returning an Option to allow null-safe handling of SQL
null
values. -
case class
RowMetadata(columns: ImmutIndexedSeq[ColumnMetadata]) extends Product with Serializable
Represents a row meta data.
Represents a row meta data.
- columns
meta data for every row column
-
trait
RowPublisher extends Publisher[Row]
A reactive streams specification's
Publisher
giving access to the rows.A reactive streams specification's
Publisher
giving access to the rows.When this publisher signals that it is complete clients can safely assume that a database is ready to accept new queries. If subscription is cancelled, however, clients have to wait for RowPublisher#done future to complete before issuing another query.
-
final
case class
SqlBigInt(value: Long) extends Product with Serializable
SQL BIGINT type
-
final
case class
SqlBinary(value: ImmutSeq[Byte]) extends Product with Serializable
SQL BINARY
-
final
case class
SqlBlob(value: ImmutSeq[Byte]) extends Product with Serializable
SQL BINARY LARGE OBJECT
-
final
case class
SqlBoolean(value: Boolean) extends Product with Serializable
SQL BOOLEAN type
-
final
case class
SqlChar(value: String) extends Product with Serializable
SQL CHARACTER
-
final
case class
SqlClob(value: String) extends Product with Serializable
SQL CHARACTER LARGE OBJECT
-
final
case class
SqlDate(value: LocalDate) extends Product with Serializable
SQL DATE type
-
final
case class
SqlDecimal(value: DecimalNumber) extends Product with Serializable
SQL DECIMAL type
-
final
case class
SqlDouble(value: Double) extends Product with Serializable
SQL DOUBLE PRECISION type
-
final
case class
SqlFloat(value: Float) extends Product with Serializable
SQL FLOAT type
-
final
case class
SqlInteger(value: Int) extends Product with Serializable
SQL INTEGER type
- trait SqlInterpolatorTrait extends AnyRef
-
implicit
class
Sql extends AnyRef
- Definition Classes
- SqlInterpolatorTrait
-
final
case class
SqlInterval(value: Period) extends Product with Serializable
SQL INTERVAL type
-
final
case class
SqlNChar(value: String) extends Product with Serializable
SQL NATIONAL CHARACTER
-
final
case class
SqlNClob(value: String) extends Product with Serializable
SQL NATIONAL CHARACTER LARGE OBJECT
-
final
case class
SqlNVarchar(value: String) extends Product with Serializable
SQL NATIONAL CHARACTER VARYING
- final case class SqlNull[T](cls: Class[T]) extends Product with Serializable
-
final
case class
SqlNumeric(value: DecimalNumber) extends Product with Serializable
SQL NUMERIC type
-
final
case class
SqlReal(value: Float) extends Product with Serializable
SQL REAL type
-
final
case class
SqlSmallInt(value: Short) extends Product with Serializable
SQL SMALLINT type
-
final
case class
SqlTime(value: LocalTime) extends Product with Serializable
SQL TIME WITHOUT TIME ZONE type
-
final
case class
SqlTimestamp(value: LocalDateTime) extends Product with Serializable
SQL TIMESTAMP type
-
final
case class
SqlTimestampTz(value: OffsetDateTime) extends Product with Serializable
SQL TIMESTAMP WITH TIME ZONE type
-
final
case class
SqlVarbinary(value: ImmutSeq[Byte]) extends Product with Serializable
SQL BINARY VARYING
-
final
case class
SqlVarchar(value: String) extends Product with Serializable
SQL CHARACTER VARYING
-
case class
SqlWithParams(sql: String, params: ImmutIndexedSeq[Any]) extends Product with Serializable
Represent a sql statement along with parameters.
Represent a sql statement along with parameters. Instances of this class are supposed to be constructed using
sql
string interpolator like this:import io.rdbc.sapi._ val id = 0 val s: SqlWithParams = sql"select * from test where id = $id"
Instances created by the interpolator can be composed:
import io.rdbc.sapi._ val x = 0 val y = 0 val s: SqlWithParams = sql"select * from test where x = $x" + sql"and y = $y"
-
trait
Statement extends AnyRef
Represents a SQL statement
Represents 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. -
final
case class
StatementOptions(generatedKeyCols: KeyColumns) extends Product with Serializable
Statement options.
Statement options.
- generatedKeyCols
says what keys generated by the database should be returned
-
final
case class
Timeout(value: Duration) extends AnyVal with Product with Serializable
Represents a timeout
Represents a timeout
- Annotations
- @implicitNotFound( ... )
-
final
case class
Warning(msg: String, code: String) extends Product with Serializable
Represents a warning emitted by a database engine during statement processing.
Represents a warning emitted by a database engine during statement processing.
- msg
database vendor specific warning message
- code
database vendor specific warning code
Value Members
-
object
BuildInfo extends Product with Serializable
This object was generated by sbt-buildinfo.
- object DecimalNumber
- object KeyColumns
- object SqlInterpolator extends SqlInterpolatorTrait
- object SqlNull extends Serializable
- object StatementOptions extends Serializable
-
object
Timeout extends Serializable
Timeout companion
TODO