kotliquery.Connection.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotliquery Show documentation
Show all versions of kotliquery Show documentation
A handy Database access library in Kotlin
The newest version!
package kotliquery
import java.sql.SQLException
/**
* Database Connection.
*/
data class Connection(
val underlying: java.sql.Connection,
val driverName: String = "",
val jtaCompatible: Boolean = false
) {
fun begin() {
underlying.autoCommit = false
if (!jtaCompatible) {
underlying.isReadOnly = false
}
}
fun commit() {
underlying.commit()
underlying.autoCommit = true
}
fun rollback() {
underlying.rollback()
try {
underlying.autoCommit = true
} catch (e: SQLException) {
}
}
fun close() {
underlying.close()
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy