comparison sql.ur @ 6:799f43bce62b

Import some code from iwl
author Adam Chlipala <adam@chlipala.net>
date Tue, 14 Dec 2010 10:33:24 -0500
parents
children d05943db55e8
comparison
equal deleted inserted replaced
5:943410267fad 6:799f43bce62b
1 fun sqexps [env] [fields] (fl : folder fields) (inj : $(map sql_injectable fields)) (r : $fields) =
2 @map2 [sql_injectable] [id] [sql_exp env [] []]
3 (fn [t] => @sql_inject)
4 fl inj r
5
6 fun selector [tn :: Name] [fs] [ofs] [fs ~ ofs] (fl : folder fs) (m : $(map sql_injectable fs)) (r : $fs) =
7 @foldR2 [sql_injectable] [id]
8 [fn key => rest :: {Type} -> [rest ~ key] => sql_exp [tn = key ++ rest] [] [] bool]
9 (fn [nm :: Name] [t :: Type] [key :: {Type}] [[nm] ~ key]
10 (inj : sql_injectable t) (v : t)
11 (exp : rest :: {Type} -> [rest ~ key] => sql_exp [tn = key ++ rest] [] [] bool)
12 [rest :: {Type}] [rest ~ [nm = t] ++ key] =>
13 (WHERE {{tn}}.{nm} = {@sql_inject inj v} AND {exp [[nm = t] ++ rest] !}))
14 (fn [rest :: {Type}] [rest ~ []] => (WHERE TRUE))
15 fl m r [_] !