toExistsQuery

fun toExistsQuery(stmt: Statement, sql: String, tableName: String): String(source)

Wraps a plain SELECT ... FROM <entity table> WHERE ... into SELECT EXISTS(SELECT 1 FROM ...) for exists* methods. If the query is not a plain select over the entity table (e.g. the user already wrote SELECT EXISTS(...), which has no FROM), it is returned unchanged.