Mercurial > urweb
annotate src/sql.sig @ 2300:57f6473b1469
More work on heuristics.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Thu, 19 Nov 2015 18:13:01 -0500 |
parents | f8903af753ff |
children |
rev | line source |
---|---|
ziv@2203 | 1 signature SQL = sig |
ziv@2203 | 2 |
ziv@2203 | 3 val debug : bool ref |
ziv@2203 | 4 |
ziv@2213 | 5 val sqlcacheMode : bool ref |
ziv@2213 | 6 |
ziv@2215 | 7 datatype chunk = |
ziv@2215 | 8 String of string |
ziv@2215 | 9 | Exp of Mono.exp |
ziv@2215 | 10 |
ziv@2215 | 11 val chunkify : Mono.exp -> chunk list |
ziv@2215 | 12 |
ziv@2204 | 13 type lvar = int |
ziv@2203 | 14 |
ziv@2203 | 15 datatype func = |
ziv@2203 | 16 DtCon0 of string |
ziv@2203 | 17 | DtCon1 of string |
ziv@2203 | 18 | UnCon of string |
ziv@2203 | 19 | Other of string |
ziv@2203 | 20 |
ziv@2203 | 21 datatype exp = |
ziv@2203 | 22 Const of Prim.t |
ziv@2203 | 23 | Var of int |
ziv@2203 | 24 | Lvar of lvar |
ziv@2203 | 25 | Func of func * exp list |
ziv@2203 | 26 | Recd of (string * exp) list |
ziv@2203 | 27 | Proj of exp * string |
ziv@2203 | 28 |
ziv@2216 | 29 datatype cmp = |
ziv@2216 | 30 Eq |
ziv@2203 | 31 | Ne |
ziv@2203 | 32 | Lt |
ziv@2203 | 33 | Le |
ziv@2203 | 34 | Gt |
ziv@2203 | 35 | Ge |
ziv@2203 | 36 |
ziv@2216 | 37 datatype reln = |
ziv@2216 | 38 Known |
ziv@2216 | 39 | Sql of string |
ziv@2216 | 40 | PCon0 of string |
ziv@2216 | 41 | PCon1 of string |
ziv@2216 | 42 | Cmp of cmp |
ziv@2216 | 43 |
ziv@2216 | 44 datatype lop = |
ziv@2216 | 45 And |
ziv@2216 | 46 | Or |
ziv@2216 | 47 |
ziv@2203 | 48 datatype prop = |
ziv@2203 | 49 True |
ziv@2203 | 50 | False |
ziv@2203 | 51 | Unknown |
ziv@2216 | 52 | Lop of lop * prop * prop |
ziv@2203 | 53 | Reln of reln * exp list |
ziv@2203 | 54 | Cond of exp * prop |
ziv@2203 | 55 |
ziv@2212 | 56 type 'a parser |
ziv@2204 | 57 |
ziv@2204 | 58 val parse : 'a parser -> Mono.exp -> 'a option |
ziv@2203 | 59 |
ziv@2203 | 60 datatype Rel = |
ziv@2216 | 61 RCmp of cmp |
ziv@2216 | 62 | RLop of lop |
ziv@2203 | 63 |
ziv@2203 | 64 datatype sqexp = |
ziv@2203 | 65 SqConst of Prim.t |
ziv@2203 | 66 | SqTrue |
ziv@2203 | 67 | SqFalse |
ziv@2203 | 68 | SqNot of sqexp |
ziv@2203 | 69 | Field of string * string |
ziv@2203 | 70 | Computed of string |
ziv@2203 | 71 | Binop of Rel * sqexp * sqexp |
ziv@2203 | 72 | SqKnown of sqexp |
ziv@2203 | 73 | Inj of Mono.exp |
ziv@2203 | 74 | SqFunc of string * sqexp |
ziv@2203 | 75 | Unmodeled |
ziv@2203 | 76 | Null |
ziv@2203 | 77 |
ziv@2204 | 78 datatype ('a,'b) sum = inl of 'a | inr of 'b |
ziv@2204 | 79 |
ziv@2203 | 80 datatype sitem = |
ziv@2203 | 81 SqField of string * string |
ziv@2203 | 82 | SqExp of sqexp * string |
ziv@2203 | 83 |
ziv@2294 | 84 datatype jtype = Inner | Left | Right | Full |
ziv@2203 | 85 |
ziv@2294 | 86 datatype fitem = |
ziv@2294 | 87 Table of string * string (* table AS name *) |
ziv@2294 | 88 | Join of jtype * fitem * fitem * sqexp |
ziv@2294 | 89 | Nested of query * string (* query AS name *) |
ziv@2294 | 90 |
ziv@2294 | 91 and query = |
ziv@2294 | 92 Query1 of {Select : sitem list, From : fitem list, Where : sqexp option} |
ziv@2203 | 93 | Union of query * query |
ziv@2203 | 94 |
ziv@2204 | 95 val query : query parser |
ziv@2204 | 96 |
ziv@2203 | 97 datatype dml = |
ziv@2203 | 98 Insert of string * (string * sqexp) list |
ziv@2203 | 99 | Delete of string * sqexp |
ziv@2203 | 100 | Update of string * (string * sqexp) list * sqexp |
ziv@2203 | 101 |
ziv@2204 | 102 val dml : dml parser |
ziv@2204 | 103 |
ziv@2203 | 104 end |