@@ -37,38 +37,38 @@ duplicates = Group "duplicates" $ map (uncurry (TestQueryExpr ansi2011))
37
37
,(" select distinct a from t" , ms Distinct )
38
38
]
39
39
where
40
- ms d = makeSelect
41
- {qeSetQuantifier = d
42
- ,qeSelectList = [(Iden [Name Nothing " a" ],Nothing )]
43
- ,qeFrom = [TRSimple [Name Nothing " t" ]]}
40
+ ms d = toQueryExpr $ makeSelect
41
+ {msSetQuantifier = d
42
+ ,msSelectList = [(Iden [Name Nothing " a" ],Nothing )]
43
+ ,msFrom = [TRSimple [Name Nothing " t" ]]}
44
44
45
45
selectLists :: TestItem
46
46
selectLists = Group " selectLists" $ map (uncurry (TestQueryExpr ansi2011))
47
47
[(" select 1" ,
48
- makeSelect {qeSelectList = [(NumLit " 1" ,Nothing )]})
48
+ toQueryExpr $ makeSelect {msSelectList = [(NumLit " 1" ,Nothing )]})
49
49
50
50
,(" select a"
51
- ,makeSelect {qeSelectList = [(Iden [Name Nothing " a" ],Nothing )]})
51
+ ,toQueryExpr $ makeSelect {msSelectList = [(Iden [Name Nothing " a" ],Nothing )]})
52
52
53
53
,(" select a,b"
54
- ,makeSelect {qeSelectList = [(Iden [Name Nothing " a" ],Nothing )
54
+ ,toQueryExpr $ makeSelect {msSelectList = [(Iden [Name Nothing " a" ],Nothing )
55
55
,(Iden [Name Nothing " b" ],Nothing )]})
56
56
57
57
,(" select 1+2,3+4"
58
- ,makeSelect {qeSelectList =
58
+ ,toQueryExpr $ makeSelect {msSelectList =
59
59
[(BinOp (NumLit " 1" ) [Name Nothing " +" ] (NumLit " 2" ),Nothing )
60
60
,(BinOp (NumLit " 3" ) [Name Nothing " +" ] (NumLit " 4" ),Nothing )]})
61
61
62
62
,(" select a as a, /*comment*/ b as b"
63
- ,makeSelect {qeSelectList = [(Iden [Name Nothing " a" ], Just $ Name Nothing " a" )
63
+ ,toQueryExpr $ makeSelect {msSelectList = [(Iden [Name Nothing " a" ], Just $ Name Nothing " a" )
64
64
,(Iden [Name Nothing " b" ], Just $ Name Nothing " b" )]})
65
65
66
66
,(" select a a, b b"
67
- ,makeSelect {qeSelectList = [(Iden [Name Nothing " a" ], Just $ Name Nothing " a" )
67
+ ,toQueryExpr $ makeSelect {msSelectList = [(Iden [Name Nothing " a" ], Just $ Name Nothing " a" )
68
68
,(Iden [Name Nothing " b" ], Just $ Name Nothing " b" )]})
69
69
70
70
,(" select a + b * c"
71
- ,makeSelect {qeSelectList =
71
+ ,toQueryExpr $ makeSelect {msSelectList =
72
72
[(BinOp (Iden [Name Nothing " a" ]) [Name Nothing " +" ]
73
73
(BinOp (Iden [Name Nothing " b" ]) [Name Nothing " *" ] (Iden [Name Nothing " c" ]))
74
74
,Nothing )]})
@@ -78,19 +78,19 @@ selectLists = Group "selectLists" $ map (uncurry (TestQueryExpr ansi2011))
78
78
whereClause :: TestItem
79
79
whereClause = Group " whereClause" $ map (uncurry (TestQueryExpr ansi2011))
80
80
[(" select a from t where a = 5"
81
- ,makeSelect {qeSelectList = [(Iden [Name Nothing " a" ],Nothing )]
82
- ,qeFrom = [TRSimple [Name Nothing " t" ]]
83
- ,qeWhere = Just $ BinOp (Iden [Name Nothing " a" ]) [Name Nothing " =" ] (NumLit " 5" )})
81
+ ,toQueryExpr $ makeSelect {msSelectList = [(Iden [Name Nothing " a" ],Nothing )]
82
+ ,msFrom = [TRSimple [Name Nothing " t" ]]
83
+ ,msWhere = Just $ BinOp (Iden [Name Nothing " a" ]) [Name Nothing " =" ] (NumLit " 5" )})
84
84
]
85
85
86
86
having :: TestItem
87
87
having = Group " having" $ map (uncurry (TestQueryExpr ansi2011))
88
88
[(" select a,sum(b) from t group by a having sum(b) > 5"
89
- ,makeSelect {qeSelectList = [(Iden [Name Nothing " a" ],Nothing )
89
+ ,toQueryExpr $ makeSelect {msSelectList = [(Iden [Name Nothing " a" ],Nothing )
90
90
,(App [Name Nothing " sum" ] [Iden [Name Nothing " b" ]],Nothing )]
91
- ,qeFrom = [TRSimple [Name Nothing " t" ]]
92
- ,qeGroupBy = [SimpleGroup $ Iden [Name Nothing " a" ]]
93
- ,qeHaving = Just $ BinOp (App [Name Nothing " sum" ] [Iden [Name Nothing " b" ]])
91
+ ,msFrom = [TRSimple [Name Nothing " t" ]]
92
+ ,msGroupBy = [SimpleGroup $ Iden [Name Nothing " a" ]]
93
+ ,msHaving = Just $ BinOp (App [Name Nothing " sum" ] [Iden [Name Nothing " b" ]])
94
94
[Name Nothing " >" ] (NumLit " 5" )
95
95
})
96
96
]
@@ -117,9 +117,9 @@ orderBy = Group "orderBy" $ map (uncurry (TestQueryExpr ansi2011))
117
117
118
118
]
119
119
where
120
- ms o = makeSelect {qeSelectList = [(Iden [Name Nothing " a" ],Nothing )]
121
- ,qeFrom = [TRSimple [Name Nothing " t" ]]
122
- ,qeOrderBy = o}
120
+ ms o = toQueryExpr $ makeSelect {msSelectList = [(Iden [Name Nothing " a" ],Nothing )]
121
+ ,msFrom = [TRSimple [Name Nothing " t" ]]
122
+ ,msOrderBy = o}
123
123
124
124
offsetFetch :: TestItem
125
125
offsetFetch = Group " offsetFetch" $ map (uncurry (TestQueryExpr ansi2011))
@@ -138,11 +138,11 @@ offsetFetch = Group "offsetFetch" $ map (uncurry (TestQueryExpr ansi2011))
138
138
-- ,ms (Just $ NumLit "5") (Just $ NumLit "10"))
139
139
]
140
140
where
141
- ms o l = makeSelect
142
- {qeSelectList = [(Iden [Name Nothing " a" ],Nothing )]
143
- ,qeFrom = [TRSimple [Name Nothing " t" ]]
144
- ,qeOffset = o
145
- ,qeFetchFirst = l}
141
+ ms o l = toQueryExpr $ makeSelect
142
+ {msSelectList = [(Iden [Name Nothing " a" ],Nothing )]
143
+ ,msFrom = [TRSimple [Name Nothing " t" ]]
144
+ ,msOffset = o
145
+ ,msFetchFirst = l}
146
146
147
147
combos :: TestItem
148
148
combos = Group " combos" $ map (uncurry (TestQueryExpr ansi2011))
@@ -164,12 +164,12 @@ combos = Group "combos" $ map (uncurry (TestQueryExpr ansi2011))
164
164
Union SQDefault Respectively mst)
165
165
]
166
166
where
167
- mst = makeSelect
168
- {qeSelectList = [(Iden [Name Nothing " a" ],Nothing )]
169
- ,qeFrom = [TRSimple [Name Nothing " t" ]]}
170
- msu = makeSelect
171
- {qeSelectList = [(Iden [Name Nothing " b" ],Nothing )]
172
- ,qeFrom = [TRSimple [Name Nothing " u" ]]}
167
+ mst = toQueryExpr $ makeSelect
168
+ {msSelectList = [(Iden [Name Nothing " a" ],Nothing )]
169
+ ,msFrom = [TRSimple [Name Nothing " t" ]]}
170
+ msu = toQueryExpr $ makeSelect
171
+ {msSelectList = [(Iden [Name Nothing " b" ],Nothing )]
172
+ ,msFrom = [TRSimple [Name Nothing " u" ]]}
173
173
174
174
175
175
withQueries :: TestItem
@@ -189,9 +189,9 @@ withQueries = Group "with queries" $ map (uncurry (TestQueryExpr ansi2011))
189
189
,With True [(Alias (Name Nothing " u" ) Nothing , ms1)] ms2)
190
190
]
191
191
where
192
- ms c t = makeSelect
193
- {qeSelectList = [(Iden [Name Nothing c],Nothing )]
194
- ,qeFrom = [TRSimple [Name Nothing t]]}
192
+ ms c t = toQueryExpr $ makeSelect
193
+ {msSelectList = [(Iden [Name Nothing c],Nothing )]
194
+ ,msFrom = [TRSimple [Name Nothing t]]}
195
195
ms1 = ms " a" " t"
196
196
ms2 = ms " a" " u"
197
197
ms3 = ms " a" " x"
0 commit comments