File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,13 @@ class QueryTests: SQLiteTestCase {
285285 AssertSQL ( " SELECT * FROM \" users \" LIMIT 1 " )
286286 }
287287
288+ func test_first_withOffset_retainsOffset( ) {
289+ insertUsers ( " alice " , " betsy " )
290+
291+ XCTAssertEqual ( 2 , users. limit ( 2 , offset: 1 ) . first![ id] )
292+ AssertSQL ( " SELECT * FROM \" users \" LIMIT 1 OFFSET 1 " )
293+ }
294+
288295 func test_isEmpty_returnsWhetherOrNotTheQueryIsEmpty( ) {
289296 XCTAssertTrue ( users. isEmpty)
290297
Original file line number Diff line number Diff line change @@ -731,7 +731,7 @@ public struct Query {
731731
732732 /// The first row (or nil if the query returns no rows).
733733 public var first : Row ? {
734- var generator = limit ( 1 ) . generate ( )
734+ var generator = limit ( to : 1 , offset : limit ? . offset ) . generate ( )
735735 return generator. next ( )
736736 }
737737
You can’t perform that action at this time.
0 commit comments