Packages

c

scalikejdbc

ActiveSession

case class ActiveSession(conn: Connection, connectionAttributes: DBConnectionAttributes, tx: Option[Tx] = None, isReadOnly: Boolean = false, settings: SettingsProvider = SettingsProvider.default) extends DBSession with Product with Serializable

Active session implementation of scalikejdbc.DBSession.

This class provides readOnly/autoCommit/localTx/withinTx blocks and session objects.

import scalikejdbc._

val userIdList = DB autoCommit { session: DBSession =>
  session.list("select * from user") { rs => rs.int("id") }
}
conn

connection

tx

transaction

isReadOnly

is read only

Source
DBSession.scala
Linear Supertypes
Serializable, Serializable, Product, Equals, DBSession, AutoCloseable, LoanPattern, LogSupport, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ActiveSession
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. DBSession
  7. AutoCloseable
  8. LoanPattern
  9. LogSupport
  10. AnyRef
  11. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ActiveSession(conn: Connection, connectionAttributes: DBConnectionAttributes, tx: Option[Tx] = None, isReadOnly: Boolean = false, settings: SettingsProvider = SettingsProvider.default)

    conn

    connection

    tx

    transaction

    isReadOnly

    is read only

Type Members

  1. type Closable = AnyRef { def close(): Unit }
    Definition Classes
    LoanPattern

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def batch[C[_]](template: String, paramsList: Seq[Any]*)(implicit cbf: CanBuildFrom[Nothing, Int, C[Int]]): C[Int]

    Executes java.sql.PreparedStatement#executeBatch().

    Executes java.sql.PreparedStatement#executeBatch().

    template

    SQL template

    paramsList

    list of parameters

    returns

    count list

    Definition Classes
    DBSession
  6. def batchAndReturnGeneratedKey[C[_]](template: String, paramsList: Seq[Any]*)(implicit cbf: CanBuildFrom[Nothing, Long, C[Long]]): C[Long]

    Executes java.sql.PreparedStatement#executeBatch() and returns numeric generated keys.

    Executes java.sql.PreparedStatement#executeBatch() and returns numeric generated keys.

    template

    SQL template

    paramsList

    list of parameters

    returns

    generated keys

    Definition Classes
    DBSession
  7. def batchAndReturnSpecifiedGeneratedKey[C[_]](template: String, key: String, paramsList: Seq[Any]*)(implicit cbf: CanBuildFrom[Nothing, Long, C[Long]]): C[Long]

    Executes java.sql.PreparedStatement#executeBatch() and returns numeric generated keys.

    Executes java.sql.PreparedStatement#executeBatch() and returns numeric generated keys.

    template

    SQL template

    key

    generated key name

    paramsList

    list of parameters

    returns

    generated keys

    Definition Classes
    DBSession
  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  9. def close(): Unit

    Close the connection.

    Close the connection.

    Definition Classes
    DBSession → AutoCloseable
  10. def collection[A, C[_]](template: String, params: Any*)(extract: (WrappedResultSet) ⇒ A)(implicit cbf: CanBuildFrom[Nothing, A, C[A]]): C[A]

    Returns query result as any Collection object.

    Returns query result as any Collection object.

    A

    return type

    C

    return collection type

    template

    SQL template

    params

    parameters

    extract

    extract function

    returns

    result as C[A]

    Definition Classes
    DBSession
  11. lazy val connection: Connection

    Connection

    Connection

    Definition Classes
    DBSession
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def execute(template: String, params: Any*): Boolean

    Executes java.sql.PreparedStatement#execute().

    Executes java.sql.PreparedStatement#execute().

    template

    SQL template

    params

    parameters

    returns

    flag

    Definition Classes
    DBSession
  14. def executeLargeUpdate(template: String, params: Any*): Long

    Executes java.sql.PreparedStatement#executeLargeUpdate().

    Executes java.sql.PreparedStatement#executeLargeUpdate().

    template

    SQL template

    params

    parameters

    returns

    result count

    Definition Classes
    DBSession
  15. def executeUpdate(template: String, params: Any*): Int

    Executes java.sql.PreparedStatement#executeUpdate().

    Executes java.sql.PreparedStatement#executeUpdate().

    template

    SQL template

    params

    parameters

    returns

    result count

    Definition Classes
    DBSession
  16. def executeWithFilters(before: (PreparedStatement) ⇒ Unit, after: (PreparedStatement) ⇒ Unit, template: String, params: Any*): Boolean

    Executes java.sql.PreparedStatement#execute().

    Executes java.sql.PreparedStatement#execute().

    before

    before filter

    after

    after filter

    template

    SQL template

    params

    parameters

    returns

    flag

    Definition Classes
    DBSession
  17. def fetchSize: Option[Int]

    Returns fetchSize for this session.

    Returns fetchSize for this session.

    returns

    fetch size

    Definition Classes
    DBSession
  18. def fetchSize(fetchSize: Option[Int]): ActiveSession.this.type
    Definition Classes
    DBSession
  19. def fetchSize(fetchSize: Int): ActiveSession.this.type

    Set fetchSize for this session.

    Set fetchSize for this session.

    fetchSize

    fetch size

    returns

    this

    Definition Classes
    DBSession
  20. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. def first[A](template: String, params: Any*)(extract: (WrappedResultSet) ⇒ A): Option[A]

    Returns the first row optionally.

    Returns the first row optionally.

    A

    return type

    template

    SQL template

    params

    parameters

    extract

    extract function

    returns

    result optionally

    Definition Classes
    DBSession
  22. def foldLeft[A](template: String, params: Any*)(z: A)(op: (A, WrappedResultSet) ⇒ A): A

    folding into one value.

    folding into one value.

    template

    SQL template

    params

    parameters

    z

    initial value

    op

    function

    returns

    folded value

    Definition Classes
    DBSession
  23. def foreach(template: String, params: Any*)(f: (WrappedResultSet) ⇒ Unit): Unit

    Applies side-effect to each row iteratively.

    Applies side-effect to each row iteratively.

    template

    SQL template

    params

    parameters

    f

    function

    returns

    result as list

    Definition Classes
    DBSession
  24. def futureUsing[R <: Closable, A](resource: R)(f: (R) ⇒ Future[A])(implicit ec: ExecutionContext): Future[A]

    Guarantees a Closeable resource will be closed after being passed to a block that takes the resource as a parameter and returns a Future.

    Guarantees a Closeable resource will be closed after being passed to a block that takes the resource as a parameter and returns a Future.

    Definition Classes
    LoanPattern
  25. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  26. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  27. val isReadOnly: Boolean

    is read-only session

    is read-only session

    Definition Classes
    ActiveSessionDBSession
  28. def largeBatch[C[_]](template: String, paramsList: Seq[Any]*)(implicit cbf: CanBuildFrom[Nothing, Long, C[Long]]): C[Long]

    Executes java.sql.PreparedStatement#executeLargeBatch().

    Executes java.sql.PreparedStatement#executeLargeBatch().

    template

    SQL template

    paramsList

    list of parameters

    returns

    count list

    Definition Classes
    DBSession
  29. def largeUpdateWithAutoGeneratedKeyNameAndFilters(returnGeneratedKeys: Boolean, generatedKeyName: String, before: (PreparedStatement) ⇒ Unit, after: (PreparedStatement) ⇒ Unit, template: String, params: Any*): Long

    Executes java.sql.PreparedStatement#executeLargeUpdate().

    Executes java.sql.PreparedStatement#executeLargeUpdate().

    returnGeneratedKeys

    is generated keys required

    generatedKeyName

    generated key name

    before

    before filter

    after

    after filter

    template

    SQL template

    params

    parameters

    returns

    result count

    Definition Classes
    DBSession
  30. def largeUpdateWithFilters(returnGeneratedKeys: Boolean, before: (PreparedStatement) ⇒ Unit, after: (PreparedStatement) ⇒ Unit, template: String, params: Any*): Long

    Executes java.sql.PreparedStatement#executeLargeUpdate().

    Executes java.sql.PreparedStatement#executeLargeUpdate().

    returnGeneratedKeys

    is generated keys required

    before

    before filter

    after

    after filter

    template

    SQL template

    params

    parameters

    returns

    result count

    Definition Classes
    DBSession
  31. def largeUpdateWithFilters(before: (PreparedStatement) ⇒ Unit, after: (PreparedStatement) ⇒ Unit, template: String, params: Any*): Long

    Executes java.sql.PreparedStatement#executeLargeUpdate().

    Executes java.sql.PreparedStatement#executeLargeUpdate().

    before

    before filter

    after

    after filter

    template

    SQL template

    params

    parameters

    returns

    result count

    Definition Classes
    DBSession
  32. def list[A](template: String, params: Any*)(extract: (WrappedResultSet) ⇒ A): List[A]

    Returns query result as scala.List object.

    Returns query result as scala.List object.

    A

    return type

    template

    SQL template

    params

    parameters

    extract

    extract function

    returns

    result as list

    Definition Classes
    DBSession
  33. val log: Log

    Logger

    Logger

    Attributes
    protected
    Definition Classes
    LogSupport
  34. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  35. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  36. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  37. def queryTimeout: Option[Int]

    Returns queryTimeout for this session.

    Returns queryTimeout for this session.

    returns

    query timeout seconds

    Definition Classes
    DBSession
  38. def queryTimeout(seconds: Option[Int]): ActiveSession.this.type
    Definition Classes
    DBSession
  39. def queryTimeout(seconds: Int): ActiveSession.this.type

    Set queryTimeout to this session.

    Set queryTimeout to this session.

    seconds

    query timeout seconds

    returns

    this

    Definition Classes
    DBSession
  40. val settings: SettingsProvider
    Definition Classes
    ActiveSessionDBSession
  41. def single[A](template: String, params: Any*)(extract: (WrappedResultSet) ⇒ A): Option[A]

    Returns single result optionally.

    Returns single result optionally. If the result is not single, scalikejdbc.TooManyRowsException will be thrown.

    A

    return type

    template

    SQL template

    params

    parameters

    extract

    extract function

    returns

    result optionally

    Definition Classes
    DBSession
  42. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  43. def tags: Seq[String]

    Returns tags for this session.

    Returns tags for this session.

    returns

    tags

    Definition Classes
    DBSession
  44. def tags(tags: String*): ActiveSession.this.type

    Set tags to this session.

    Set tags to this session.

    tags

    tags

    returns

    this

    Definition Classes
    DBSession
  45. def toBatchStatementExecutor(template: String): StatementExecutor
    Definition Classes
    DBSession
  46. def toStatementExecutor(template: String, params: Seq[Any], returnGeneratedKeys: Boolean = false): StatementExecutor
    Definition Classes
    DBSession
  47. def traversable[A](template: String, params: Any*)(extract: (WrappedResultSet) ⇒ A): Traversable[A]

    Returns query result as scala.collection.Traversable object.

    Returns query result as scala.collection.Traversable object.

    A

    return type

    template

    SQL template

    params

    parameters

    extract

    extract function

    returns

    result as traversable

    Definition Classes
    DBSession
  48. val tx: Option[Tx]

    Returns current transaction if exists.

    Returns current transaction if exists.

    Definition Classes
    ActiveSessionDBSession
  49. def unexpectedInvocation[A]: A
    Attributes
    protected
    Definition Classes
    DBSession
  50. def update(template: String, params: Any*): Int

    Executes java.sql.PreparedStatement#executeUpdate().

    Executes java.sql.PreparedStatement#executeUpdate().

    template

    SQL template

    params

    parameters

    returns

    result count

    Definition Classes
    DBSession
  51. def updateAndReturnGeneratedKey(template: String, params: Any*): Long

    Executes java.sql.PreparedStatement#executeUpdate() and returns the generated key.

    Executes java.sql.PreparedStatement#executeUpdate() and returns the generated key.

    template

    SQL template

    params

    parameters

    returns

    generated key as a long value

    Definition Classes
    DBSession
  52. def updateAndReturnSpecifiedGeneratedKey(template: String, params: Any*)(key: Any): Long

    Executes java.sql.PreparedStatement#executeUpdate() and returns the generated key.

    Executes java.sql.PreparedStatement#executeUpdate() and returns the generated key.

    template

    SQL template

    params

    parameters

    key

    name

    returns

    generated key as a long value

    Definition Classes
    DBSession
  53. def updateWithAutoGeneratedKeyNameAndFilters(returnGeneratedKeys: Boolean, generatedKeyName: String, before: (PreparedStatement) ⇒ Unit, after: (PreparedStatement) ⇒ Unit, template: String, params: Any*): Int

    Executes java.sql.PreparedStatement#executeUpdate().

    Executes java.sql.PreparedStatement#executeUpdate().

    returnGeneratedKeys

    is generated keys required

    generatedKeyName

    generated key name

    before

    before filter

    after

    after filter

    template

    SQL template

    params

    parameters

    returns

    result count

    Definition Classes
    DBSession
  54. def updateWithFilters(returnGeneratedKeys: Boolean, before: (PreparedStatement) ⇒ Unit, after: (PreparedStatement) ⇒ Unit, template: String, params: Any*): Int

    Executes java.sql.PreparedStatement#executeUpdate().

    Executes java.sql.PreparedStatement#executeUpdate().

    returnGeneratedKeys

    is generated keys required

    before

    before filter

    after

    after filter

    template

    SQL template

    params

    parameters

    returns

    result count

    Definition Classes
    DBSession
  55. def updateWithFilters(before: (PreparedStatement) ⇒ Unit, after: (PreparedStatement) ⇒ Unit, template: String, params: Any*): Int

    Executes java.sql.PreparedStatement#executeUpdate().

    Executes java.sql.PreparedStatement#executeUpdate().

    before

    before filter

    after

    after filter

    template

    SQL template

    params

    parameters

    returns

    result count

    Definition Classes
    DBSession
  56. def using[R <: Closable, A](resource: R)(f: (R) ⇒ A): A
    Definition Classes
    LoanPattern
  57. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  58. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  59. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from DBSession

Inherited from AutoCloseable

Inherited from LoanPattern

Inherited from LogSupport

Inherited from AnyRef

Inherited from Any

Ungrouped