Packages

trait DBSession extends LogSupport with LoanPattern with AutoCloseable

DB Session

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") }
}
Source
DBSession.scala
Linear Supertypes
AutoCloseable, LoanPattern, LogSupport, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DBSession
  2. AutoCloseable
  3. LoanPattern
  4. LogSupport
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

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

Abstract Value Members

  1. abstract val isReadOnly: Boolean

    is read-only session

  2. abstract def settings: SettingsProvider
    Attributes
    protected[scalikejdbc]

Concrete 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

  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

  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

  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @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]

  11. lazy val connection: Connection

    Connection

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

    Executes java.sql.PreparedStatement#execute().

    Executes java.sql.PreparedStatement#execute().

    template

    SQL template

    params

    parameters

    returns

    flag

  15. 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

  16. 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

  17. 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

  18. def fetchSize: Option[Int]

    Returns fetchSize for this session.

    Returns fetchSize for this session.

    returns

    fetch size

  19. def fetchSize(fetchSize: Option[Int]): DBSession.this.type
  20. def fetchSize(fetchSize: Int): DBSession.this.type

    Set fetchSize for this session.

    Set fetchSize for this session.

    fetchSize

    fetch size

    returns

    this

  21. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  22. 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

  23. 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

  24. 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

  25. 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
  26. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  27. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  28. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  29. 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

  30. 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

  31. 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

  32. 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

  33. 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

  34. val log: Log

    Logger

    Logger

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

    Returns queryTimeout for this session.

    Returns queryTimeout for this session.

    returns

    query timeout seconds

  39. def queryTimeout(seconds: Option[Int]): DBSession.this.type
  40. def queryTimeout(seconds: Int): DBSession.this.type

    Set queryTimeout to this session.

    Set queryTimeout to this session.

    seconds

    query timeout seconds

    returns

    this

  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

  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

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

    Set tags to this session.

    Set tags to this session.

    tags

    tags

    returns

    this

  45. def toBatchStatementExecutor(template: String): StatementExecutor
  46. def toStatementExecutor(template: String, params: Seq[Any], returnGeneratedKeys: Boolean = false): StatementExecutor
  47. def toString(): String
    Definition Classes
    AnyRef → Any
  48. 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

  49. def tx: Option[Tx]

    Returns current transaction if exists.

  50. def unexpectedInvocation[A]: A
    Attributes
    protected
  51. 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

  52. 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

  53. 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

  54. 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

  55. 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

  56. 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

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

Inherited from AutoCloseable

Inherited from LoanPattern

Inherited from LogSupport

Inherited from AnyRef

Inherited from Any

Ungrouped