Return [] rather than nothing on no results

Fixes #70
This commit is contained in:
Joe Nelson
2014-10-14 11:23:26 -07:00
parent 17ada69411
commit 21e4e583ec
5 changed files with 7 additions and 8 deletions
+2 -2
View File
@@ -71,11 +71,11 @@ getRows schema table qq range conn = do
r <- quickQuery conn query []
return $ case r of
[[total, _, SqlNull]] -> RangedResult offset 0 (fromSql total) ""
[[total, _, SqlNull]] -> RangedResult offset 0 (fromSql total) "[]"
[[total, limited_total, json]] ->
RangedResult offset (offset + fromSql limited_total - 1)
(fromSql total) (fromSql json)
_ -> RangedResult 0 0 0 ""
_ -> RangedResult 0 0 0 "[]"
where
offset = fromMaybe 0 $ R.offset <$> range