withRowLimit

fun withRowLimit(stmt: Statement, sql: String, rowCount: Long): String(source)

Appends a LIMIT [rowCount] to a SELECT that has none, so findOne* methods fetch at most a couple of rows while still detecting a multi-row result. Returns the SQL unchanged for anything that already has a limit or is not a plain select. LIMIT n is portable across all supported dialects (PostgreSQL, MySQL, SQLite).