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

kotlin.jdbc.PreparedStatements.kt Maven / Gradle / Ivy

There is a newer version: 0.14.451
Show newest version
package kotlin.jdbc

/**
 * Helper method to process a statement on this collection
 */
import java.sql.PreparedStatement
import java.sql.ResultSet

fun PreparedStatement.update(): Int {
    try {
        return this.executeUpdate()
    } finally {
        close()
    }
}

fun  PreparedStatement.query(block: (ResultSet) -> T): T {
    try {
        val resultSet = this.executeQuery()
        return block(resultSet)
    } finally {
        close()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy