[history] Support of kotlin unsigned integer types
This commit is contained in:
parent
2cee34c427
commit
7202132455
@ -52,11 +52,16 @@ public inline fun <R> Connection.transaction(t: (Connection) -> R): R {
|
||||
}
|
||||
|
||||
|
||||
public fun Connection.executeStatement(@Language("SQL") sql: String) {
|
||||
this.prepareStatement(sql) { ps -> ps.execute() }
|
||||
}
|
||||
|
||||
|
||||
public inline fun <R> Connection.prepareStatement(@Language("SQL") sql: String, action: (PreparedStatement) -> R): R {
|
||||
contract {
|
||||
callsInPlace(action, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
this.prepareStatement(sql/*.trim(' ', '\n', '\t')*/).use { ps -> return action(ps) }
|
||||
this.prepareStatement(sql).use { ps -> return action(ps) }
|
||||
}
|
||||
|
||||
public inline fun <R, C : MutableCollection<R>> ResultSet.mapTo(to: C, transform: (rs: ResultSet) -> R): C {
|
||||
@ -81,3 +86,28 @@ public inline fun <R> PreparedStatement.executeQuery(action: (ResultSet) -> R):
|
||||
}
|
||||
return this.executeQuery().use(action)
|
||||
}
|
||||
|
||||
|
||||
public fun PreparedStatement.setUByte(parameterIndex: Int, value: UByte): Unit =
|
||||
this.setByte(parameterIndex, value.toByte())
|
||||
|
||||
public fun PreparedStatement.setUShort(parameterIndex: Int, value: UShort): Unit =
|
||||
this.setShort(parameterIndex, value.toShort())
|
||||
|
||||
public fun PreparedStatement.setUInt(parameterIndex: Int, value: UInt): Unit =
|
||||
this.setInt(parameterIndex, value.toInt())
|
||||
|
||||
public fun PreparedStatement.setULong(parameterIndex: Int, value: ULong): Unit =
|
||||
this.setLong(parameterIndex, value.toLong())
|
||||
|
||||
public fun ResultSet.getUByte(columnIndex: Int): UByte =
|
||||
this.getByte(columnIndex).toUByte()
|
||||
|
||||
public fun ResultSet.getUShort(columnIndex: Int): UShort =
|
||||
this.getShort(columnIndex).toUShort()
|
||||
|
||||
public fun ResultSet.getUInt(columnIndex: Int): UInt =
|
||||
this.getInt(columnIndex).toUInt()
|
||||
|
||||
public fun ResultSet.getULong(columnIndex: Int): ULong =
|
||||
this.getLong(columnIndex).toULong()
|
Loading…
Reference in New Issue
Block a user