Skip to content

Commit

Permalink
check point
Browse files Browse the repository at this point in the history
  • Loading branch information
hohonuuli committed Nov 2, 2024
1 parent 8681985 commit d885eed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ object PreparedStatementGenerator:
val offset = query.offset.map(o => s"OFFSET $o").getOrElse("")
s"$limit $offset"
else
if (query.limit.isEmpty && query.offset.isEmpty) return ""
else
val offset = query.offset.getOrElse(0)
val fetch = query.limit match
case Some(l) => s"FETCH NEXT $l ROWS ONLY"
case None => ""
s"OFFSET $offset ROWS $fetch"
val offset = query.offset.getOrElse(0)
val fetch = query.limit match
case Some(l) => s"FETCH NEXT $l ROWS ONLY"
case None => ""
s"OFFSET $offset ROWS $fetch"

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class QueryService(databaseConfig: DatabaseConfig, viewName: String):
ResultSet.CONCUR_READ_ONLY
)
)
query.limit.foreach(stmt.setMaxRows)
// query.limit.foreach(stmt.setMaxRows)
// TODO may have to add some database specific code here
// query.offset.foreach(stmt.setF)
PreparedStatementGenerator.bind(stmt, query.where)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ trait QueryServiceSuite extends BaseDAOSuite:

}

test("query distinct concept with limit") {
test("query distinct concept with limit and offset") {
val im = TestUtils.create(5, 2, 1)
val query = Query(select = Seq("concept"), distinct = true,
limit = Some(2), offset = Some(1))
Expand Down

0 comments on commit d885eed

Please sign in to comment.