Mercurial > urweb
comparison lib/ur/list.ur @ 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 | 9e0fa4f6ac93 |
children | 3061d1bf4b2d |
comparison
equal
deleted
inserted
replaced
1393:802c179dac1f | 1394:d328983dc5a6 |
---|---|
252 in | 252 in |
253 app' | 253 app' |
254 end | 254 end |
255 | 255 |
256 fun mapQuery [tables ::: {{Type}}] [exps ::: {Type}] [t ::: Type] | 256 fun mapQuery [tables ::: {{Type}}] [exps ::: {Type}] [t ::: Type] |
257 [tables ~ exps] (q : sql_query [] tables exps) | 257 [tables ~ exps] (q : sql_query [] [] tables exps) |
258 (f : $(exps ++ map (fn fields :: {Type} => $fields) tables) -> t) = | 258 (f : $(exps ++ map (fn fields :: {Type} => $fields) tables) -> t) = |
259 ls <- query q | 259 ls <- query q |
260 (fn fs acc => return (f fs :: acc)) | 260 (fn fs acc => return (f fs :: acc)) |
261 []; | 261 []; |
262 return (rev ls) | 262 return (rev ls) |
263 | 263 |
264 fun mapQueryM [tables ::: {{Type}}] [exps ::: {Type}] [t ::: Type] | 264 fun mapQueryM [tables ::: {{Type}}] [exps ::: {Type}] [t ::: Type] |
265 [tables ~ exps] (q : sql_query [] tables exps) | 265 [tables ~ exps] (q : sql_query [] [] tables exps) |
266 (f : $(exps ++ map (fn fields :: {Type} => $fields) tables) -> transaction t) = | 266 (f : $(exps ++ map (fn fields :: {Type} => $fields) tables) -> transaction t) = |
267 ls <- query q | 267 ls <- query q |
268 (fn fs acc => v <- f fs; return (v :: acc)) | 268 (fn fs acc => v <- f fs; return (v :: acc)) |
269 []; | 269 []; |
270 return (rev ls) | 270 return (rev ls) |
271 | 271 |
272 fun mapQueryPartialM [tables ::: {{Type}}] [exps ::: {Type}] [t ::: Type] | 272 fun mapQueryPartialM [tables ::: {{Type}}] [exps ::: {Type}] [t ::: Type] |
273 [tables ~ exps] (q : sql_query [] tables exps) | 273 [tables ~ exps] (q : sql_query [] [] tables exps) |
274 (f : $(exps ++ map (fn fields :: {Type} => $fields) tables) -> transaction (option t)) = | 274 (f : $(exps ++ map (fn fields :: {Type} => $fields) tables) -> transaction (option t)) = |
275 ls <- query q | 275 ls <- query q |
276 (fn fs acc => v <- f fs; | 276 (fn fs acc => v <- f fs; |
277 return (case v of | 277 return (case v of |
278 None => acc | 278 None => acc |