Mercurial > urweb
comparison src/sql.sml @ 2216:70ec9bb337be
Progress towards invalidation based on equalities of fields.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Mon, 10 Nov 2014 22:04:40 -0500 |
parents | 639e62ca2530 |
children | 0aae15c2a05a |
comparison
equal
deleted
inserted
replaced
2215:639e62ca2530 | 2216:70ec9bb337be |
---|---|
18 | Lvar of lvar | 18 | Lvar of lvar |
19 | Func of func * exp list | 19 | Func of func * exp list |
20 | Recd of (string * exp) list | 20 | Recd of (string * exp) list |
21 | Proj of exp * string | 21 | Proj of exp * string |
22 | 22 |
23 datatype cmp = | |
24 Eq | |
25 | Ne | |
26 | Lt | |
27 | Le | |
28 | Gt | |
29 | Ge | |
30 | |
23 datatype reln = | 31 datatype reln = |
24 Known | 32 Known |
25 | Sql of string | 33 | Sql of string |
26 | PCon0 of string | 34 | PCon0 of string |
27 | PCon1 of string | 35 | PCon1 of string |
28 | Eq | 36 | Cmp of cmp |
29 | Ne | 37 |
30 | Lt | 38 datatype lop = |
31 | Le | 39 And |
32 | Gt | 40 | Or |
33 | Ge | |
34 | 41 |
35 datatype prop = | 42 datatype prop = |
36 True | 43 True |
37 | False | 44 | False |
38 | Unknown | 45 | Unknown |
39 | And of prop * prop | 46 | Lop of lop * prop * prop |
40 | Or of prop * prop | |
41 | Reln of reln * exp list | 47 | Reln of reln * exp list |
42 | Cond of exp * prop | 48 | Cond of exp * prop |
43 | 49 |
44 datatype chunk = | 50 datatype chunk = |
45 String of string | 51 String of string |
181 uw_ident) | 187 uw_ident) |
182 (fn (SOME (t, ()), f) => (t, f) | 188 (fn (SOME (t, ()), f) => (t, f) |
183 | (NONE, f) => ("T", f)) (* Should probably deal with this MySQL/SQLite case better some day. *) | 189 | (NONE, f) => ("T", f)) (* Should probably deal with this MySQL/SQLite case better some day. *) |
184 | 190 |
185 datatype Rel = | 191 datatype Rel = |
186 Exps of exp * exp -> prop | 192 RCmp of cmp |
187 | Props of prop * prop -> prop | 193 | RLop of lop |
188 | 194 |
189 datatype sqexp = | 195 datatype sqexp = |
190 SqConst of Prim.t | 196 SqConst of Prim.t |
191 | SqTrue | 197 | SqTrue |
192 | SqFalse | 198 | SqFalse |
198 | Inj of Mono.exp | 204 | Inj of Mono.exp |
199 | SqFunc of string * sqexp | 205 | SqFunc of string * sqexp |
200 | Unmodeled | 206 | Unmodeled |
201 | Null | 207 | Null |
202 | 208 |
203 fun cmp s r = wrap (const s) (fn () => Exps (fn (e1, e2) => Reln (r, [e1, e2]))) | 209 fun cmp s r = wrap (const s) (fn () => RCmp r) |
204 | 210 |
205 val sqbrel = altL [cmp "=" Eq, | 211 val sqbrel = altL [cmp "=" Eq, |
206 cmp "<>" Ne, | 212 cmp "<>" Ne, |
207 cmp "<=" Le, | 213 cmp "<=" Le, |
208 cmp "<" Lt, | 214 cmp "<" Lt, |
209 cmp ">=" Ge, | 215 cmp ">=" Ge, |
210 cmp ">" Gt, | 216 cmp ">" Gt, |
211 wrap (const "AND") (fn () => Props And), | 217 wrap (const "AND") (fn () => RLop Or), |
212 wrap (const "OR") (fn () => Props Or)] | 218 wrap (const "OR") (fn () => RLop And)] |
213 | 219 |
214 datatype ('a, 'b) sum = inl of 'a | inr of 'b | 220 datatype ('a, 'b) sum = inl of 'a | inr of 'b |
215 | 221 |
216 fun string chs = | 222 fun string chs = |
217 case chs of | 223 case chs of |