Skip to content

Commit

Permalink
Syntax: ForUpdate after Pagination with Limit and Offset
Browse files Browse the repository at this point in the history
  • Loading branch information
ElfoLiNk committed Jul 2, 2017
1 parent e8f849d commit 951886d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/org/squeryl/internals/DatabaseAdapter.scala
Expand Up @@ -162,9 +162,9 @@ trait DatabaseAdapter {
sw.pushPendingNextLine
}

writeEndOfQueryHint(() => qen.isForUpdate, qen, sw)

writePaginatedQueryDeclaration(() => qen.page, qen, sw)

writeEndOfQueryHint(() => qen.isForUpdate, qen, sw)
}

def writeUnionQueryOptions(qen: QueryExpressionElements, sw: StatementWriter): Unit = {
Expand Down
9 changes: 9 additions & 0 deletions src/test/scala/org/squeryl/test/schooldb/SchoolDb.scala
Expand Up @@ -1237,6 +1237,15 @@ abstract class SchoolDbTestRun extends SchoolDbTestBase {
passed('testForUpdate)
}

test("PaginatedForUpdate") {
val testInstance = sharedTestInstance; import testInstance._
val t = professors.where(p => p.id === tournesol.id).page(0, 1).forUpdate.single

assert(t.yearlySalary == 80.0, "expected 80.0, got " + t.yearlySalary)
assert(t.weight == Some(70.5), "expected Some(70.5), got " + t.weight)

passed('testForUpdate)
}


test("PartialUpdate1") {
Expand Down

0 comments on commit 951886d

Please sign in to comment.