Mercurial > meta
view 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 |
line wrap: on
line source
fun sqexps [env] [fields] (fl : folder fields) (inj : $(map sql_injectable fields)) (r : $fields) = @map2 [sql_injectable] [id] [sql_exp env [] []] (fn [t] => @sql_inject) fl inj r fun selector [tn :: Name] [fs] [ofs] [fs ~ ofs] (fl : folder fs) (m : $(map sql_injectable fs)) (r : $fs) = @foldR2 [sql_injectable] [id] [fn key => rest :: {Type} -> [rest ~ key] => sql_exp [tn = key ++ rest] [] [] bool] (fn [nm :: Name] [t :: Type] [key :: {Type}] [[nm] ~ key] (inj : sql_injectable t) (v : t) (exp : rest :: {Type} -> [rest ~ key] => sql_exp [tn = key ++ rest] [] [] bool) [rest :: {Type}] [rest ~ [nm = t] ++ key] => (WHERE {{tn}}.{nm} = {@sql_inject inj v} AND {exp [[nm = t] ++ rest] !})) (fn [rest :: {Type}] [rest ~ []] => (WHERE TRUE)) fl m r [_] !