Permalink
Browse files

Bug fix: Create proper LIMIT clause for H2.

If there's an OFFSET, we must also specify a LIMIT. In most DBMSs,
LIMIT 0 means unlimited but in H2 it really means "do not return any
rows". LIMIT -1 can be used for no limit.

This makes PagingTest work with H2 using the new code generator.
  • Loading branch information...
1 parent d08d3ca commit 0b8f6e8db289dc639d1debf37df025f1794c1bd9 @szeiger committed Mar 23, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/main/scala/org/scalaquery/ql/extended/H2Driver.scala
@@ -35,7 +35,7 @@ class H2QueryBuilder(_query: Query[_, _], profile: H2Driver) extends BasicQueryB
override protected def appendTakeDropClause(take: Option[Int], drop: Option[Int]) = (take, drop) match {
case (Some(t), Some(d)) => b += " LIMIT " += t += " OFFSET " += d
case (Some(t), None) => b += " LIMIT " += t
- case (None, Some(d)) => b += " LIMIT 0 OFFSET " += d
+ case (None, Some(d)) => b += " LIMIT -1 OFFSET " += d
case _ =>
}
}

0 comments on commit 0b8f6e8

Please sign in to comment.