English | 简体中文

api-docs / org.ktorm.database / Database / executeExpression

executeExpression

inline fun <T> executeExpression(
    expression: SqlExpression,
    func: (PreparedStatement) -> T
): T
(source code)

Format the given expression to a SQL string with its execution arguments, then create
a PreparedStatement for the database using the SQL string and execute the specific
callback function with it. After the callback function completes, the statement will be
closed automatically.

Parameters

expression - the SQL expression to be executed.

func - the callback function.

Since
2.7

Return
the result of the callback function.