rearrange the test code and add some notes on postgres
This commit is contained in:
parent
86ba354e26
commit
6ff8c9ddc5
10 changed files with 940 additions and 591 deletions
tools/Language/SQL/SimpleSQL
38
tools/Language/SQL/SimpleSQL/FullQueries.lhs
Normal file
38
tools/Language/SQL/SimpleSQL/FullQueries.lhs
Normal file
|
@ -0,0 +1,38 @@
|
|||
|
||||
Some tests for parsing full queries.
|
||||
|
||||
> module Language.SQL.SimpleSQL.FullQueries (fullQueriesTests) where
|
||||
|
||||
> import Language.SQL.SimpleSQL.TestTypes
|
||||
> import Language.SQL.SimpleSQL.Syntax
|
||||
|
||||
|
||||
> fullQueriesTests :: TestItem
|
||||
> fullQueriesTests = Group "queries" $ map (uncurry TestQueryExpr)
|
||||
> [("select count(*) from t"
|
||||
> ,makeSelect
|
||||
> {qeSelectList = [(Nothing, App "count" [Star])]
|
||||
> ,qeFrom = [TRSimple "t"]
|
||||
> }
|
||||
> )
|
||||
|
||||
> ,("select a, sum(c+d) as s\n\
|
||||
> \ from t,u\n\
|
||||
> \ where a > 5\n\
|
||||
> \ group by a\n\
|
||||
> \ having count(1) > 5\n\
|
||||
> \ order by s"
|
||||
> ,makeSelect
|
||||
> {qeSelectList = [(Nothing, Iden "a")
|
||||
> ,(Just "s"
|
||||
> ,App "sum" [BinOp (Iden "c")
|
||||
> "+" (Iden "d")])]
|
||||
> ,qeFrom = [TRSimple "t", TRSimple "u"]
|
||||
> ,qeWhere = Just $ BinOp (Iden "a") ">" (NumLit "5")
|
||||
> ,qeGroupBy = [Iden "a"]
|
||||
> ,qeHaving = Just $ BinOp (App "count" [NumLit "1"])
|
||||
> ">" (NumLit "5")
|
||||
> ,qeOrderBy = [(Iden "s", Asc)]
|
||||
> }
|
||||
> )
|
||||
> ]
|
Loading…
Add table
Add a link
Reference in a new issue