annotate src/sql.sig @ 2279:32a407902d3b

Rewrite LRU cache. Now uses one big hash table and is less buggy.
author Ziv Scully <ziv@mit.edu>
date Wed, 11 Nov 2015 20:01:48 -0500
parents 70ec9bb337be
children f8903af753ff
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@2204 84 type query1 = {Select : sitem list,
ziv@2204 85 From : (string * string) list,
ziv@2204 86 Where : sqexp option}
ziv@2203 87
ziv@2203 88 datatype query =
ziv@2203 89 Query1 of query1
ziv@2203 90 | Union of query * query
ziv@2203 91
ziv@2204 92 val query : query parser
ziv@2204 93
ziv@2203 94 datatype dml =
ziv@2203 95 Insert of string * (string * sqexp) list
ziv@2203 96 | Delete of string * sqexp
ziv@2203 97 | Update of string * (string * sqexp) list * sqexp
ziv@2203 98
ziv@2204 99 val dml : dml parser
ziv@2204 100
ziv@2203 101 end