Skip to content

Commit

Permalink
Build LIMIT only if size is strictly positive (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquerie authored and Tapac committed Jun 20, 2019
1 parent fc42e5a commit 71ef31f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,14 @@ abstract class FunctionProvider {
open fun replace(table: Table, data: List<Pair<Column<*>, Any?>>, transaction: Transaction): String
= transaction.throwUnsupportedException("There's no generic SQL for replace. There must be vendor specific implementation")

open fun queryLimit(size: Int, offset: Int, alreadyOrdered: Boolean) = "LIMIT $size" + if (offset > 0) " OFFSET $offset" else ""
open fun queryLimit(size: Int, offset: Int, alreadyOrdered: Boolean) = buildString {
if (size > 0) {
append("LIMIT $size")
if (offset > 0) {
append(" OFFSET $offset")
}
}
}

open fun <T : String?> groupConcat(expr: GroupConcat<T>, queryBuilder: QueryBuilder) = buildString {
append("GROUP_CONCAT(")
Expand Down

0 comments on commit 71ef31f

Please sign in to comment.