English | 简体中文

api-docs / org.ktorm.support.sqlite

Package org.ktorm.support.sqlite

SQLite dialect module for Ktorm.

Types

NameSummary

BulkInsertExpression

data class BulkInsertExpression : SqlExpression

Bulk insert expression, represents a bulk insert statement in SQLite.

BulkInsertOrUpdateStatementBuilder

class BulkInsertOrUpdateStatementBuilder<T : BaseTable<*>> : 
    BulkInsertStatementBuilder<T>

DSL builder for bulk insert or update statements.

BulkInsertStatementBuilder

open class BulkInsertStatementBuilder<T : BaseTable<*>>

DSL builder for bulk insert statements.

InsertOrUpdateExpression

data class InsertOrUpdateExpression : SqlExpression

Insert or update expression, represents an insert statement with an
on conflict (key) do update set clause in SQLite.

InsertOrUpdateOnConflictClauseBuilder

class InsertOrUpdateOnConflictClauseBuilder : 
    SQLiteAssignmentsBuilder

DSL builder for insert or update on conflict clause.

InsertOrUpdateStatementBuilder

class InsertOrUpdateStatementBuilder : 
    SQLiteAssignmentsBuilder

DSL builder for insert or update statements.

SQLiteAssignmentsBuilder

open class SQLiteAssignmentsBuilder : AssignmentsBuilder

Base class of SQLite DSL builders, provide basic functions used to build assignments for insert or update DSL.

SQLiteDialect

open class SQLiteDialect : SqlDialect

SqlDialect implementation for SQLite database.

SQLiteExpressionVisitor

interface SQLiteExpressionVisitor : SqlExpressionVisitor

Base interface designed to visit or modify SQLite expression trees using visitor pattern.

SQLiteFormatter

open class SQLiteFormatter : 
    SqlFormatter,
    SQLiteExpressionVisitor

SqlFormatter implementation for SQLite, formatting SQL expressions as strings with their execution arguments.

Functions

NameSummary

bulkInsert

fun <T : BaseTable<*>> Database.bulkInsert(
    table: T,
    block: BulkInsertStatementBuilder<T>.(T) -> Unit
): Int

Bulk insert records to the table and return the effected row count.

bulkInsertOrUpdate

fun <T : BaseTable<*>> Database.bulkInsertOrUpdate(
    table: T,
    block: BulkInsertOrUpdateStatementBuilder<T>.(T) -> Unit
): Int

Bulk insert records to the table, determining if there is a key conflict while inserting each of them,
and automatically performs updates if any conflict exists.

bulkInsertOrUpdateReturning

fun <T : BaseTable<*>, C : Any> Database.bulkInsertOrUpdateReturning(
    table: T,
    returning: Column<C>,
    block: BulkInsertOrUpdateStatementBuilder<T>.(T) -> Unit
): List<C?>

Bulk insert records to the table, determining if there is a key conflict while inserting each of them,
automatically performs updates if any conflict exists, and finally returns the specific column.

fun <T : BaseTable<*>, C1 : Any, C2 : Any> Database.bulkInsertOrUpdateReturning(
    table: T,
    returning: Pair<Column<C1>, Column<C2>>,
    block: BulkInsertOrUpdateStatementBuilder<T>.(T) -> Unit
): List<Pair<C1?, C2?>>

fun <T : BaseTable<*>, C1 : Any, C2 : Any, C3 : Any> Database.bulkInsertOrUpdateReturning(
    table: T,
    returning: Triple<Column<C1>, Column<C2>, Column<C3>>,
    block: BulkInsertOrUpdateStatementBuilder<T>.(T) -> Unit
): List<Triple<C1?, C2?, C3?>>

Bulk insert records to the table, determining if there is a key conflict while inserting each of them,
automatically performs updates if any conflict exists, and finally returns the specific columns.

bulkInsertReturning

fun <T : BaseTable<*>, C : Any> Database.bulkInsertReturning(
    table: T,
    returning: Column<C>,
    block: BulkInsertStatementBuilder<T>.(T) -> Unit
): List<C?>

Bulk insert records to the table and return the specific column’s values.

fun <T : BaseTable<*>, C1 : Any, C2 : Any> Database.bulkInsertReturning(
    table: T,
    returning: Pair<Column<C1>, Column<C2>>,
    block: BulkInsertStatementBuilder<T>.(T) -> Unit
): List<Pair<C1?, C2?>>

fun <T : BaseTable<*>, C1 : Any, C2 : Any, C3 : Any> Database.bulkInsertReturning(
    table: T,
    returning: Triple<Column<C1>, Column<C2>, Column<C3>>,
    block: BulkInsertStatementBuilder<T>.(T) -> Unit
): List<Triple<C1?, C2?, C3?>>

Bulk insert records to the table and return the specific columns’ values.

ifNull

fun <T : Any> ColumnDeclaring<T>.ifNull(
    right: ColumnDeclaring<T>
): FunctionExpression<T>

fun <T : Any> ColumnDeclaring<T>.ifNull(
    right: T?
): FunctionExpression<T>

SQLite ifnull function, translated to ifnull(left, right).

iif

fun <T : Any> iif(
    condition: ColumnDeclaring<Boolean>,
    then: ColumnDeclaring<T>,
    otherwise: ColumnDeclaring<T>
): FunctionExpression<T>

fun <T : Any> iif(
    condition: ColumnDeclaring<Boolean>,
    then: T,
    otherwise: T,
    sqlType: SqlType<T> = SqlType.of() ?: error("Cannot detect the param's SqlType, please specify manually.")
): FunctionExpression<T>

SQLite iif function, translated to iif(condition, then, otherwise).

insertOrUpdate

fun <T : BaseTable<*>> Database.insertOrUpdate(
    table: T,
    block: InsertOrUpdateStatementBuilder.(T) -> Unit
): Int

Insert a record to the table, determining if there is a key conflict while it’s being inserted, and automatically
performs an update if any conflict exists.

insertOrUpdateReturning

fun <T : BaseTable<*>, C : Any> Database.insertOrUpdateReturning(
    table: T,
    returning: Column<C>,
    block: InsertOrUpdateStatementBuilder.(T) -> Unit
): C?

Insert a record to the table, determining if there is a key conflict while it’s being inserted, automatically
performs an update if any conflict exists, and finally returns the specific column.

fun <T : BaseTable<*>, C1 : Any, C2 : Any> Database.insertOrUpdateReturning(
    table: T,
    returning: Pair<Column<C1>, Column<C2>>,
    block: InsertOrUpdateStatementBuilder.(T) -> Unit
): Pair<C1?, C2?>

fun <T : BaseTable<*>, C1 : Any, C2 : Any, C3 : Any> Database.insertOrUpdateReturning(
    table: T,
    returning: Triple<Column<C1>, Column<C2>, Column<C3>>,
    block: InsertOrUpdateStatementBuilder.(T) -> Unit
): Triple<C1?, C2?, C3?>

Insert a record to the table, determining if there is a key conflict while it’s being inserted, automatically
performs an update if any conflict exists, and finally returns the specific columns.

insertReturning

fun <T : BaseTable<*>, C : Any> Database.insertReturning(
    table: T,
    returning: Column<C>,
    block: AssignmentsBuilder.(T) -> Unit
): C?

Insert a record to the table and return the specific column.

fun <T : BaseTable<*>, C1 : Any, C2 : Any> Database.insertReturning(
    table: T,
    returning: Pair<Column<C1>, Column<C2>>,
    block: AssignmentsBuilder.(T) -> Unit
): Pair<C1?, C2?>

fun <T : BaseTable<*>, C1 : Any, C2 : Any, C3 : Any> Database.insertReturning(
    table: T,
    returning: Triple<Column<C1>, Column<C2>, Column<C3>>,
    block: AssignmentsBuilder.(T) -> Unit
): Triple<C1?, C2?, C3?>

Insert a record to the table and return the specific columns.

instr


fun ColumnDeclaring<String>.instr(
    right: String
): FunctionExpression<Int>

SQLite instr function, translated to instr(left, right).

jsonExtract

fun <T : Any> ColumnDeclaring<*>.jsonExtract(
    path: String,
    sqlType: SqlType<T> = SqlType.of() ?: error("Cannot detect the result's SqlType, please specify manually.")
): FunctionExpression<T>

SQLite json_extract function, translated to json_extract(column, path).

jsonPatch

fun ColumnDeclaring<*>.jsonPatch(
    right: ColumnDeclaring<*>
): FunctionExpression<String>

SQLite json_patch function, translated to json_patch(left, right).

jsonRemove

fun ColumnDeclaring<*>.jsonRemove(
    path: String
): FunctionExpression<String>

SQLite json_remove function, translated to json_remove(column, path).

jsonValid

SQLite json_valid function, translated to json_valid(column).

random

fun random(): FunctionExpression<Long>

SQLite random function, translated to random().

replace

fun ColumnDeclaring<String>.replace(
    oldValue: String,
    newValue: String
): FunctionExpression<String>

SQLite replace function, translated to replace(str, oldValue, newValue).

toLowerCase

SQLite lower function, translated to lower(str).

toUpperCase

SQLite upper function, translated to upper(str).