Mercurial > urweb
annotate src/sql.sig @ 2204:01c8aceac480
Finishes initial prototype, caching parameterless pages with table-match-based invalidation. Still has problems parsing non-Postgres SQL dialects properly.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Tue, 27 May 2014 21:14:13 -0400 |
parents | 39faa4a037f4 |
children | 388ba4dc7c96 |
rev | line source |
---|---|
ziv@2203 | 1 signature SQL = sig |
ziv@2203 | 2 |
ziv@2203 | 3 val debug : bool ref |
ziv@2203 | 4 |
ziv@2204 | 5 type lvar = int |
ziv@2203 | 6 |
ziv@2203 | 7 datatype func = |
ziv@2203 | 8 DtCon0 of string |
ziv@2203 | 9 | DtCon1 of string |
ziv@2203 | 10 | UnCon of string |
ziv@2203 | 11 | Other of string |
ziv@2203 | 12 |
ziv@2203 | 13 datatype exp = |
ziv@2203 | 14 Const of Prim.t |
ziv@2203 | 15 | Var of int |
ziv@2203 | 16 | Lvar of lvar |
ziv@2203 | 17 | Func of func * exp list |
ziv@2203 | 18 | Recd of (string * exp) list |
ziv@2203 | 19 | Proj of exp * string |
ziv@2203 | 20 |
ziv@2203 | 21 datatype reln = |
ziv@2203 | 22 Known |
ziv@2203 | 23 | Sql of string |
ziv@2203 | 24 | PCon0 of string |
ziv@2203 | 25 | PCon1 of string |
ziv@2203 | 26 | Eq |
ziv@2203 | 27 | Ne |
ziv@2203 | 28 | Lt |
ziv@2203 | 29 | Le |
ziv@2203 | 30 | Gt |
ziv@2203 | 31 | Ge |
ziv@2203 | 32 |
ziv@2203 | 33 datatype prop = |
ziv@2203 | 34 True |
ziv@2203 | 35 | False |
ziv@2203 | 36 | Unknown |
ziv@2203 | 37 | And of prop * prop |
ziv@2203 | 38 | Or of prop * prop |
ziv@2203 | 39 | Reln of reln * exp list |
ziv@2203 | 40 | Cond of exp * prop |
ziv@2203 | 41 |
ziv@2204 | 42 datatype chunk = |
ziv@2204 | 43 String of string |
ziv@2204 | 44 | Exp of Mono.exp |
ziv@2204 | 45 |
ziv@2204 | 46 type 'a parser = chunk list -> ('a * chunk list) option |
ziv@2204 | 47 |
ziv@2204 | 48 val parse : 'a parser -> Mono.exp -> 'a option |
ziv@2203 | 49 |
ziv@2203 | 50 datatype Rel = |
ziv@2203 | 51 Exps of exp * exp -> prop |
ziv@2203 | 52 | Props of prop * prop -> prop |
ziv@2203 | 53 |
ziv@2203 | 54 datatype sqexp = |
ziv@2203 | 55 SqConst of Prim.t |
ziv@2203 | 56 | SqTrue |
ziv@2203 | 57 | SqFalse |
ziv@2203 | 58 | SqNot of sqexp |
ziv@2203 | 59 | Field of string * string |
ziv@2203 | 60 | Computed of string |
ziv@2203 | 61 | Binop of Rel * sqexp * sqexp |
ziv@2203 | 62 | SqKnown of sqexp |
ziv@2203 | 63 | Inj of Mono.exp |
ziv@2203 | 64 | SqFunc of string * sqexp |
ziv@2203 | 65 | Unmodeled |
ziv@2203 | 66 | Null |
ziv@2203 | 67 |
ziv@2204 | 68 datatype ('a,'b) sum = inl of 'a | inr of 'b |
ziv@2204 | 69 |
ziv@2203 | 70 datatype sitem = |
ziv@2203 | 71 SqField of string * string |
ziv@2203 | 72 | SqExp of sqexp * string |
ziv@2203 | 73 |
ziv@2204 | 74 type query1 = {Select : sitem list, |
ziv@2204 | 75 From : (string * string) list, |
ziv@2204 | 76 Where : sqexp option} |
ziv@2203 | 77 |
ziv@2203 | 78 datatype query = |
ziv@2203 | 79 Query1 of query1 |
ziv@2203 | 80 | Union of query * query |
ziv@2203 | 81 |
ziv@2204 | 82 val query : query parser |
ziv@2204 | 83 |
ziv@2203 | 84 datatype dml = |
ziv@2203 | 85 Insert of string * (string * sqexp) list |
ziv@2203 | 86 | Delete of string * sqexp |
ziv@2203 | 87 | Update of string * (string * sqexp) list * sqexp |
ziv@2203 | 88 |
ziv@2204 | 89 val dml : dml parser |
ziv@2204 | 90 |
ziv@2203 | 91 end |