fun getReusable(): ReusableGenericStatement
Gives a reference to a reusable statement object. This allows clients to avoid the (small) lookup overhead for a frequently-used statement.
Usage:
val intParam = Parameter(Types.sqlInt)
var r = ""
val stmt = (db.statement() + "SELECT " + TestTable.testName + " FROM " + TestTable +
" WHERE " + TestTable.id + "=" + intParam).getReusable()
stmt run { generic ->
generic[intParam] = testRow
generic.resultHandler = { execOK, stmt ->
assert(execOK)
val found = rs.next()
assert(found)
val rs = stmt.resultSet
r = rs.getString(1)
}
}
Throws IllegalStateException if this statement is not cacheable.