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

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

The 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