Reject ranges that start beyond last item
This commit is contained in:
+2
-2
@@ -29,7 +29,7 @@ data RangedResult = RangedResult {
|
||||
, rrTo :: Int
|
||||
, rrTotal :: Int
|
||||
, rrBody :: BL.ByteString
|
||||
}
|
||||
} deriving (Show)
|
||||
|
||||
type QuotedSql = (String, [SqlValue])
|
||||
|
||||
@@ -44,7 +44,7 @@ getRows schema table qq range conn = do
|
||||
r <- quickQuery conn query []
|
||||
|
||||
return $ case r of
|
||||
[[_, _, SqlNull]] -> RangedResult 0 0 0 ""
|
||||
[[total, _, SqlNull]] -> RangedResult offset 0 (fromSql total) ""
|
||||
[[total, limited_total, json]] ->
|
||||
RangedResult offset (offset + fromSql limited_total - 1)
|
||||
(fromSql total) (fromSql json)
|
||||
|
||||
Reference in New Issue
Block a user