forEachObject

inline fun <T : Any> forEachObject(params: Map<String, Any?>, fetchSize: Int, crossinline block: (T) -> Unit)

Streams the result, mapping each row onto T and handing it to block.

Carries the same constraints as forEachRow: batches of fetchSize, one running statement for the whole iteration, and no re-entering this session from block.

Parameters

params

Values by parameter name, without the leading @.

fetchSize

Rows per batch, or 0 for the whole result in one. Required — there is no default.

block

Invoked once per mapped row, on the calling thread.

Type Parameters

T

The type each row is mapped to.

Throws

if a row cannot be mapped onto T, or wrapping anything block throws that is not an OctaviusException.


inline fun <T : Any> forEachObject(vararg params: Pair<String, Any?>, fetchSize: Int, crossinline block: (T) -> Unit)

Same as forEachObject, with the values given as Pairs.