DbClient

scalasql.core.DbClient
See theDbClient companion object
trait DbClient

A database client. Primarily allows you to access the database within a transaction block or via getAutoCommitClientConnection

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Connection
class DataSource

Members list

Value members

Abstract methods

Provides a DbApi that you can use to run queries in "auto-commit" mode, such that every query runs in its own transaction and is committed automatically on-completion.

Provides a DbApi that you can use to run queries in "auto-commit" mode, such that every query runs in its own transaction and is committed automatically on-completion.

This can be useful for interactive testing, but requires that you manually manage the closing of the connection to avoid leaking connections (if using a connection pool like HikariCP), and should be avoided in most production environments in favor of .transaction{...} blocks.

Attributes

def renderSql[Q, R](query: Q, castParams: Boolean)(implicit qr: Queryable[Q, R]): String

Converts the given query Q into a string. Useful for debugging and logging

Converts the given query Q into a string. Useful for debugging and logging

Attributes

def transaction[T](block: Txn => T): T

Opens a database transaction within the given block, automatically committing it if the block returns successfully and rolling it back if the blow fails with an uncaught exception. Within the block, you provides a DbApi.Txn you can use to run queries, create savepoints, or roll back the transaction.

Opens a database transaction within the given block, automatically committing it if the block returns successfully and rolling it back if the blow fails with an uncaught exception. Within the block, you provides a DbApi.Txn you can use to run queries, create savepoints, or roll back the transaction.

Attributes