English | 简体中文

api-docs / org.ktorm.database / SqlDialect

SqlDialect

interface SqlDialect (source code)

Representation of a SQL dialect.

It’s known that there is a uniform standard for SQL language, but beyond the standard, many databases still have
their special features. The interface provides an extension mechanism for Ktorm and its extension modules to support
those dialect-specific SQL features.

Implementations of this interface are recommended to be published as separated modules independent of ktorm-core.

To enable a dialect, applications should add the dialect module to the classpath first, then configure the dialect
parameter to the dialect implementation while creating database instances via Database.connect functions.

Since version 2.4, Ktorm’s dialect modules start following the convention of JDK ServiceLoader SPI, so we don’t
need to specify the dialect parameter explicitly anymore while creating Database instances. Ktorm auto detects
one for us from the classpath. We just need to insure the dialect module exists in the dependencies.

Functions

NameSummary

createSqlFormatter

open fun createSqlFormatter(
    database: Database,
    beautifySql: Boolean,
    indentSize: Int
): SqlFormatter

Create a SqlFormatter instance, formatting SQL expressions as strings with their execution arguments.

executeUpdateAndRetrieveKeys

open fun executeUpdateAndRetrieveKeys(
    database: Database,
    sql: String,
    args: List<ArgumentExpression<*>>
): Pair<Int, CachedRowSet>

Execute the given SQL string (typically an insert statement), then return the effected row count along with
the generated keys.

Inheritors

NameSummary

MySqlDialect

open class MySqlDialect : SqlDialect

SqlDialect implementation for MySQL database.

OracleDialect

open class OracleDialect : SqlDialect

SqlDialect implementation for Oracle database.

PostgreSqlDialect

open class PostgreSqlDialect : SqlDialect

SqlDialect implementation for PostgreSQL database.

SQLiteDialect

open class SQLiteDialect : SqlDialect

SqlDialect implementation for SQLite database.

SqlServerDialect

open class SqlServerDialect : SqlDialect

SqlDialect implementation for Microsoft SqlServer database.