withStatement

open fun <R, E : Exception?> withStatement(@Language(value = "PostgreSQL") @NotNull sql: @NotNull String, @NotNull statementFunction: @NotNull StatementFunction<R, E>): R(source)

Creates a statement from the given SQL statement, runs the function and closes the statement.

Parameters

sql

An SQL statement that may contain one or more '?' IN parameter placeholders

statementFunction

The function to run with the prepared statement


open fun <R, E : Exception?> withStatement(@Language(value = "PostgreSQL") @NotNull sql: @NotNull String, columnIndexes: @NotNull Array<Int>, @NotNull statementFunction: @NotNull StatementFunction<R, E>): R(source)

Creates a statement from the given SQL statement, runs the function and closes the statement.

Parameters

sql

An SQL statement that may contain one or more '?' IN parameter placeholders

columnIndexes

An array of column indexes indicating the columns that should be returned from the inserted row or rows

statementFunction

The function to run with the prepared statement


open fun <R, E : Exception?> withStatement(@Language(value = "PostgreSQL") @NotNull sql: @NotNull String, @NotNull columnNames: @NotNull Array<@NotNull String>, @NotNull statementFunction: @NotNull StatementFunction<R, E>): R(source)

Creates a statement from the given SQL statement, runs the function and closes the statement.

Parameters

sql

An SQL statement that may contain one or more '?' IN parameter placeholders

columnNames

An array of column names indicating the columns that should be returned from the inserted row or rows

statementFunction

The function to run with the prepared statement