Skip to content

Commit

Permalink
FilterAnd []
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Dec 16, 2011
1 parent 81fcd58 commit a5bf39c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions persistent-test/PersistentTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ specs = describe "persistent" $ do
it "FilterOr []" $ db $ do
_ <- selectList [FilterOr []] [Desc PersonAge]
return ()
it "FilterAnd []" $ db $ do
_ <- selectList [FilterAnd []] [Desc PersonAge]
return ()
it "order of opts is irrelevant" $ db $ do
let eq (a, b, _) (c, d) = (a, b) @== (c, d)
limitOffsetOrder [Desc PersonAge] `eq` (0, 0)
Expand Down
1 change: 1 addition & 0 deletions persistent/Database/Persist/GenericSql/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ filterClauseHelper includeTable includeWhere conn filters =
(a, b) = unzip $ map go fs
wrapP x = concat ["(", x, ")"]

go (FilterAnd []) = ("1=0", [])
go (FilterAnd fs) = combineAND fs
go (FilterOr []) = ("1=1", [])
go (FilterOr fs) = combine " OR " fs
Expand Down

0 comments on commit a5bf39c

Please sign in to comment.