SqlDialect

interface SqlDialect(source)

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

Link copied to clipboard

Create a default visitor instance for this dialect using the specific interceptor.

Link copied to clipboard
open fun createSqlFormatter(database: Database, beautifySql: Boolean, indentSize: Int): SqlFormatter

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

Link copied to clipboard

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