All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.komapper.dialect.sqlserver.jdbc.SqlServerJdbcDialect.kt Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
package org.komapper.dialect.sqlserver.jdbc

import org.komapper.dialect.sqlserver.SqlServerDialect
import org.komapper.jdbc.JdbcDialect
import java.sql.SQLException

interface SqlServerJdbcDialect : SqlServerDialect, JdbcDialect {

    override fun isUniqueConstraintViolationError(exception: SQLException): Boolean {
        return exception.filterIsInstance().any {
            it.errorCode == SqlServerDialect.UNIQUE_CONSTRAINT_VIOLATION_ERROR_CODE
        }
    }

    override fun isSequenceExistsError(exception: SQLException): Boolean {
        return exception.filterIsInstance().any {
            it.errorCode == SqlServerDialect.OBJECT_ALREADY_EXISTS_ERROR_CODE
        }
    }

    override fun isTableExistsError(exception: SQLException): Boolean {
        return exception.filterIsInstance().any {
            it.errorCode == SqlServerDialect.OBJECT_ALREADY_EXISTS_ERROR_CODE
        }
    }

    override fun supportsBatchExecutionReturningGeneratedValues(): Boolean = false
}

private object SqlServerJdbcDialectImpl : SqlServerJdbcDialect

fun SqlServerJdbcDialect(): SqlServerJdbcDialect {
    return SqlServerJdbcDialectImpl
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy