1 (** Global list of tables *)
7 let all : table list
ref = ref []
9 (** @raise Error when no such table *)
10 let get_from tables name
=
12 List.find
(fun (n
,_
) -> n
= name
) tables
13 with Not_found
-> failwith
(sprintf
"no such table %s" name
)
15 let get name
= get_from !all name
16 let get_schema name
= snd
(get name
)
17 let check name
= ignore
(get name
)
20 let (name
,schema
) = v
in
21 match List.find_all
(fun (n
,_
) -> n
= name
) !all with
22 | [] -> all := v
:: !all
23 | _
-> failwith
(sprintf
"table %s already exists" name
)
25 let print () = List.iter
RA.print_table
!all
27 let reset () = all := []