open Relation;;
open Func;;
+
+exception BooleExpTrue
+
let init connection_param = Dbconn.init connection_param
let close () = Dbconn.close ()
-let check () = Dbconn.pgc ()
-
-exception BooleExpTrue
+let check () =
+ let status = Dbconn.pgc ()
+ in ()
let stat = ref false
let get_stat () = ! stat
+let dbname = ref "db-postgres"
+
+let set_database db = dbname := db
+
(* valuta una MathQL.set_exp e ritorna un MathQL.resource_set *)
let rec exec_set_exp c = function
res
| MathQL.Relation (rop, path, sexp, attl) ->
let before = Sys.time() in
- let res = relation_ex rop path (exec_set_exp c sexp) attl in
- if !stat then
- (print_string ("RELATION " ^ (List.hd path) ^ " = " ^ string_of_int(List.length res) ^ ": ");
- print_endline (string_of_float (Sys.time() -. before) ^ "s");
- flush stdout);
- res
+ if !dbname = "db-postgres" then
+ (let res = relation_ex rop path (exec_set_exp c sexp) attl in
+ if !stat then
+ (print_string ("RELATION " ^ (List.hd path) ^ " = " ^ string_of_int(List.length res) ^ ": ");
+ print_endline (string_of_float (Sys.time() -. before) ^ "s");
+ flush stdout);
+ res)
+ else
+ (let res = relation_galax_ex rop path (exec_set_exp c sexp) attl in
+ if !stat then
+ (print_string ("RELATION-GALAX " ^ (List.hd path) ^ " = " ^ string_of_int(List.length res) ^ ": ");
+ print_endline (string_of_float (Sys.time() -. before) ^ "s");
+ flush stdout);
+ res)
+
+
| MathQL.Select (rvar, sexp, bexp) ->
let before = Sys.time() in
let rset = (exec_set_exp c sexp) in
| MathQL.VVar s -> List.assoc s c.vvars
| MathQL.RefOf sexp -> List.map (fun (s,_) -> s) (exec_set_exp c sexp)
| MathQL.Fun (s, vexp) -> fun_ex s (exec_val_exp c vexp)
- | _ -> assert false
+ | MathQL.Attribute (rop, path, vexp) -> []
(* valuta una MathQL.set_exp nel contesto vuoto e ritorna un MathQL.resource_set *)
and execute x =