SQLite

class SQLite(url: String, options: QueryExecutor.Pool.Options = QueryExecutor.Pool.Options()) : ISQLite(source)

A database driver for SQLite, implemented with connection pooling and transactional support. This class provides mechanisms to execute SQL queries, manage database connections, and handle transactions in a coroutine-based environment.

sqlite::memory: | Open an in-memory database. sqlite:data.db | Open the file data.db in the current directory. sqlite://data.db | Open the file data.db in the current directory. sqlite:///data.db | Open the file data.db from the root (/) directory. sqlite://data.db?mode=ro | Open the file data.db for read-only access.

Parameters

url

The URL string for connecting to the SQLite database.

options

Configuration options for the connection pool, such as minimum and maximum connections, timeout durations, etc.

Constructors

Link copied to clipboard
constructor(url: String, options: QueryExecutor.Pool.Options = QueryExecutor.Pool.Options())

Types

Link copied to clipboard
class Cn(rt: <Error class: unknown class><out <Error class: unknown class>>, cn: <Error class: unknown class><out <Error class: unknown class>>) : Connection

Represents a native database connection that implements the Connection interface.

Link copied to clipboard
object Companion
Link copied to clipboard
class Tx(rt: <Error class: unknown class><out <Error class: unknown class>>, tx: <Error class: unknown class><out <Error class: unknown class>>) : Transaction

Represents a specific implementation of the Transaction interface. This class facilitates the management of database transactions, including methods to commit, roll back, execute queries, and fetch results.

Functions

Link copied to clipboard
open suspend override fun acquire(): Result<Connection>
Link copied to clipboard
open suspend override fun begin(): Result<Transaction>
Link copied to clipboard
open suspend override fun close(): Result<Unit>
Link copied to clipboard
open suspend override fun execute(statement: Statement): Result<Long>
open suspend override fun execute(sql: String): Result<Long>
Link copied to clipboard
open suspend fun <T> fetchAll(sql: String, rowMapper: RowMapper<T>): Result<List<T>>
open suspend override fun fetchAll(statement: Statement): Result<ResultSet>
open suspend override fun fetchAll(sql: String): Result<ResultSet>
open suspend override fun <T> fetchAll(statement: Statement, rowMapper: RowMapper<T>): Result<List<T>>
Link copied to clipboard
open suspend override fun migrate(path: String, table: String): Result<Unit>
Link copied to clipboard
open override fun poolIdleSize(): Int
Link copied to clipboard
open override fun poolSize(): Int
Link copied to clipboard
open suspend fun <T> transaction(f: suspend Transaction.() -> T): T