preparedStatement

inline fun <R> preparedStatement(@Language(value = "PostgreSQL") sql: String, generatedKeys: Boolean = false, block: SuspendingPreparedStatement.() -> R): R(source)

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

The returned keys are accessible using getGeneratedKeys.

Parameters

sql

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

generatedKeys

true to return the generated keys

See also


inline fun <R> preparedStatement(@Language(value = "PostgreSQL") sql: String, columnIndexes: IntArray, block: SuspendingPreparedStatement.() -> R): R(source)

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

The returned keys are accessible using getGeneratedKeys.

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

See also


inline fun <R> preparedStatement(@Language(value = "PostgreSQL") sql: String, columnNames: Array<out String>, block: SuspendingPreparedStatement.() -> R): R(source)

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

The returned keys are accessible using getGeneratedKeys.

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

See also