comparison lib/ur/top.urs @ 1394:d328983dc5a6

Allow subqueries to reference aggregate-only columns of free tables; treat non-COUNT aggregate functions as possibly returning NULL
author Adam Chlipala <adam@chlipala.net>
date Sat, 15 Jan 2011 14:53:13 -0500
parents 7dd8a6704265
children 8631e9ed0ee8
comparison
equal deleted inserted replaced
1393:802c179dac1f 1394:d328983dc5a6
124 -> r ::: {K} -> folder r 124 -> r ::: {K} -> folder r
125 -> $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> xml ctx [] [] 125 -> $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> xml ctx [] []
126 126
127 val queryL : tables ::: {{Type}} -> exps ::: {Type} 127 val queryL : tables ::: {{Type}} -> exps ::: {Type}
128 -> [tables ~ exps] => 128 -> [tables ~ exps] =>
129 sql_query [] tables exps 129 sql_query [] [] tables exps
130 -> transaction (list $(exps ++ map (fn fields :: {Type} => $fields) tables)) 130 -> transaction (list $(exps ++ map (fn fields :: {Type} => $fields) tables))
131 131
132 val queryL1 : t ::: Name -> fs ::: {Type} 132 val queryL1 : t ::: Name -> fs ::: {Type}
133 -> sql_query [] [t = fs] [] 133 -> sql_query [] [] [t = fs] []
134 -> transaction (list $fs) 134 -> transaction (list $fs)
135 135
136 val query1 : t ::: Name -> fs ::: {Type} -> state ::: Type 136 val query1 : t ::: Name -> fs ::: {Type} -> state ::: Type
137 -> sql_query [] [t = fs] [] 137 -> sql_query [] [] [t = fs] []
138 -> ($fs -> state -> transaction state) 138 -> ($fs -> state -> transaction state)
139 -> state 139 -> state
140 -> transaction state 140 -> transaction state
141 141
142 val query1' : t ::: Name -> fs ::: {Type} -> state ::: Type 142 val query1' : t ::: Name -> fs ::: {Type} -> state ::: Type
143 -> sql_query [] [t = fs] [] 143 -> sql_query [] [] [t = fs] []
144 -> ($fs -> state -> state) 144 -> ($fs -> state -> state)
145 -> state 145 -> state
146 -> transaction state 146 -> transaction state
147 147
148 val queryI : tables ::: {{Type}} -> exps ::: {Type} 148 val queryI : tables ::: {{Type}} -> exps ::: {Type}
149 -> [tables ~ exps] => 149 -> [tables ~ exps] =>
150 sql_query [] tables exps 150 sql_query [] [] tables exps
151 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables) 151 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables)
152 -> transaction unit) 152 -> transaction unit)
153 -> transaction unit 153 -> transaction unit
154 154
155 val queryI1 : nm ::: Name -> fs ::: {Type} 155 val queryI1 : nm ::: Name -> fs ::: {Type}
156 -> sql_query [] [nm = fs] [] 156 -> sql_query [] [] [nm = fs] []
157 -> ($fs -> transaction unit) 157 -> ($fs -> transaction unit)
158 -> transaction unit 158 -> transaction unit
159 159
160 val queryX : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit} -> inp ::: {Type} 160 val queryX : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit} -> inp ::: {Type}
161 -> [tables ~ exps] => 161 -> [tables ~ exps] =>
162 sql_query [] tables exps 162 sql_query [] [] tables exps
163 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables) 163 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables)
164 -> xml ctx inp []) 164 -> xml ctx inp [])
165 -> transaction (xml ctx inp []) 165 -> transaction (xml ctx inp [])
166 166
167 val queryX1 : nm ::: Name -> fs ::: {Type} -> ctx ::: {Unit} -> inp ::: {Type} 167 val queryX1 : nm ::: Name -> fs ::: {Type} -> ctx ::: {Unit} -> inp ::: {Type}
168 -> sql_query [] [nm = fs] [] 168 -> sql_query [] [] [nm = fs] []
169 -> ($fs -> xml ctx inp []) 169 -> ($fs -> xml ctx inp [])
170 -> transaction (xml ctx inp []) 170 -> transaction (xml ctx inp [])
171 171
172 val queryX' : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit} -> inp ::: {Type} 172 val queryX' : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit} -> inp ::: {Type}
173 -> [tables ~ exps] => 173 -> [tables ~ exps] =>
174 sql_query [] tables exps 174 sql_query [] [] tables exps
175 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables) 175 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables)
176 -> transaction (xml ctx inp [])) 176 -> transaction (xml ctx inp []))
177 -> transaction (xml ctx inp []) 177 -> transaction (xml ctx inp [])
178 val queryX1' : nm ::: Name -> fs ::: {Type} -> ctx ::: {Unit} -> inp ::: {Type} 178 val queryX1' : nm ::: Name -> fs ::: {Type} -> ctx ::: {Unit} -> inp ::: {Type}
179 -> sql_query [] [nm = fs] [] 179 -> sql_query [] [] [nm = fs] []
180 -> ($fs -> transaction (xml ctx inp [])) 180 -> ($fs -> transaction (xml ctx inp []))
181 -> transaction (xml ctx inp []) 181 -> transaction (xml ctx inp [])
182 val queryXE' : exps ::: {Type} -> ctx ::: {Unit} -> inp ::: {Type} 182 val queryXE' : exps ::: {Type} -> ctx ::: {Unit} -> inp ::: {Type}
183 -> sql_query [] [] exps 183 -> sql_query [] [] [] exps
184 -> ($exps -> transaction (xml ctx inp [])) 184 -> ($exps -> transaction (xml ctx inp []))
185 -> transaction (xml ctx inp []) 185 -> transaction (xml ctx inp [])
186 186
187 val hasRows : tables ::: {{Type}} -> exps ::: {Type} 187 val hasRows : tables ::: {{Type}} -> exps ::: {Type}
188 -> [tables ~ exps] => 188 -> [tables ~ exps] =>
189 sql_query [] tables exps 189 sql_query [] [] tables exps
190 -> transaction bool 190 -> transaction bool
191 191
192 val oneOrNoRows : tables ::: {{Type}} -> exps ::: {Type} 192 val oneOrNoRows : tables ::: {{Type}} -> exps ::: {Type}
193 -> [tables ~ exps] => 193 -> [tables ~ exps] =>
194 sql_query [] tables exps 194 sql_query [] [] tables exps
195 -> transaction 195 -> transaction
196 (option 196 (option
197 $(exps 197 $(exps
198 ++ map (fn fields :: {Type} => $fields) tables)) 198 ++ map (fn fields :: {Type} => $fields) tables))
199 199
200 val oneOrNoRows1 : nm ::: Name -> fs ::: {Type} 200 val oneOrNoRows1 : nm ::: Name -> fs ::: {Type}
201 -> sql_query [] [nm = fs] [] 201 -> sql_query [] [] [nm = fs] []
202 -> transaction (option $fs) 202 -> transaction (option $fs)
203 203
204 val oneOrNoRowsE1 : tabs ::: {Unit} -> nm ::: Name -> t ::: Type 204 val oneOrNoRowsE1 : tabs ::: {Unit} -> nm ::: Name -> t ::: Type
205 -> [tabs ~ [nm]] => 205 -> [tabs ~ [nm]] =>
206 sql_query [] (mapU [] tabs) [nm = t] 206 sql_query [] [] (mapU [] tabs) [nm = t]
207 -> transaction (option t) 207 -> transaction (option t)
208 208
209 val oneRow : tables ::: {{Type}} -> exps ::: {Type} 209 val oneRow : tables ::: {{Type}} -> exps ::: {Type}
210 -> [tables ~ exps] => 210 -> [tables ~ exps] =>
211 sql_query [] tables exps 211 sql_query [] [] tables exps
212 -> transaction 212 -> transaction
213 $(exps 213 $(exps
214 ++ map (fn fields :: {Type} => $fields) tables) 214 ++ map (fn fields :: {Type} => $fields) tables)
215 215
216 val oneRow1 : nm ::: Name -> fs ::: {Type} 216 val oneRow1 : nm ::: Name -> fs ::: {Type}
217 -> sql_query [] [nm = fs] [] 217 -> sql_query [] [] [nm = fs] []
218 -> transaction $fs 218 -> transaction $fs
219 219
220 val oneRowE1 : tabs ::: {Unit} -> nm ::: Name -> t ::: Type 220 val oneRowE1 : tabs ::: {Unit} -> nm ::: Name -> t ::: Type
221 -> [tabs ~ [nm]] => 221 -> [tabs ~ [nm]] =>
222 sql_query [] (mapU [] tabs) [nm = t] 222 sql_query [] [] (mapU [] tabs) [nm = t]
223 -> transaction t 223 -> transaction t
224 224
225 val nonempty : fs ::: {Type} -> us ::: {{Unit}} -> sql_table fs us 225 val nonempty : fs ::: {Type} -> us ::: {{Unit}} -> sql_table fs us
226 -> transaction bool 226 -> transaction bool
227 227