From 36aa72077bd8753ccbb2a047d65a2886e984e853 Mon Sep 17 00:00:00 2001 From: Ferruccio Guidi Date: Fri, 27 Feb 2004 14:06:41 +0000 Subject: [PATCH] now database interfaces are more abstract --- helm/ocaml/mathql_interpreter/.depend | 16 ++++---- helm/ocaml/mathql_interpreter/Makefile | 5 ++- helm/ocaml/mathql_interpreter/mQIConn.mli | 7 ++-- helm/ocaml/mathql_interpreter/mQIMySql.mli | 8 ++-- helm/ocaml/mathql_interpreter/mQIPostgres.mli | 10 ++--- helm/ocaml/mathql_interpreter/mQIProperty.mli | 8 ++-- helm/ocaml/mathql_interpreter/mQITypes.ml | 41 +++++++++++++++++++ 7 files changed, 63 insertions(+), 32 deletions(-) create mode 100644 helm/ocaml/mathql_interpreter/mQITypes.ml diff --git a/helm/ocaml/mathql_interpreter/.depend b/helm/ocaml/mathql_interpreter/.depend index c9d883b21..c675ba352 100644 --- a/helm/ocaml/mathql_interpreter/.depend +++ b/helm/ocaml/mathql_interpreter/.depend @@ -1,4 +1,6 @@ -mQIConn.cmi: mQIMap.cmi mQIPostgres.cmi +mQIPostgres.cmi: mQITypes.cmo +mQIMySql.cmi: mQITypes.cmo +mQIConn.cmi: mQIMap.cmi mQITypes.cmo mQIProperty.cmi: mQIConn.cmi mQueryInterpreter.cmi: mQIConn.cmi mQueryTParser.cmo: mQueryTParser.cmi @@ -9,20 +11,16 @@ mQueryUtil.cmo: mQueryTLexer.cmo mQueryTParser.cmi mQueryUtil.cmi mQueryUtil.cmx: mQueryTLexer.cmx mQueryTParser.cmx mQueryUtil.cmi mQIUtil.cmo: mQIUtil.cmi mQIUtil.cmx: mQIUtil.cmi -mQIDataBase.cmo: mQIDataBase.cmi -mQIDataBase.cmx: mQIDataBase.cmi mQIPostgres.cmo: mQIPostgres.cmi mQIPostgres.cmx: mQIPostgres.cmi mQIMySql.cmo: mQIMySql.cmi mQIMySql.cmx: mQIMySql.cmi mQIMap.cmo: mQueryUtil.cmi mQIMap.cmi mQIMap.cmx: mQueryUtil.cmx mQIMap.cmi -mQIConn.cmo: mQIDataBase.cmi mQIMap.cmi mQIConn.cmi -mQIConn.cmx: mQIDataBase.cmx mQIMap.cmx mQIConn.cmi -mQIProperty.cmo: mQIConn.cmi mQIDataBase.cmi mQIMap.cmi mQIUtil.cmi \ - mQIProperty.cmi -mQIProperty.cmx: mQIConn.cmx mQIDataBase.cmx mQIMap.cmx mQIUtil.cmx \ - mQIProperty.cmi +mQIConn.cmo: mQIMap.cmi mQIMySql.cmi mQIPostgres.cmi mQIConn.cmi +mQIConn.cmx: mQIMap.cmx mQIMySql.cmx mQIPostgres.cmx mQIConn.cmi +mQIProperty.cmo: mQIConn.cmi mQIMap.cmi mQIUtil.cmi mQIProperty.cmi +mQIProperty.cmx: mQIConn.cmx mQIMap.cmx mQIUtil.cmx mQIProperty.cmi mQueryInterpreter.cmo: mQIConn.cmi mQIProperty.cmi mQIUtil.cmi mQueryUtil.cmi \ mQueryInterpreter.cmi mQueryInterpreter.cmx: mQIConn.cmx mQIProperty.cmx mQIUtil.cmx mQueryUtil.cmx \ diff --git a/helm/ocaml/mathql_interpreter/Makefile b/helm/ocaml/mathql_interpreter/Makefile index 2f842bb6b..7d21bc6ba 100644 --- a/helm/ocaml/mathql_interpreter/Makefile +++ b/helm/ocaml/mathql_interpreter/Makefile @@ -9,10 +9,11 @@ INTERFACE_FILES = mQueryUtil.mli mQIUtil.mli \ mQIProperty.mli mQueryInterpreter.mli IMPLEMENTATION_FILES = mQueryTParser.ml mQueryTLexer.ml \ - $(INTERFACE_FILES:%.mli=%.ml) + mQITypes.ml $(INTERFACE_FILES:%.mli=%.ml) EXTRA_OBJECTS_TO_INSTALL = mQueryTLexer.cmi \ - mQueryTLexer.mll mQueryTParser.mly + mQueryTLexer.mll mQueryTParser.mly \ + mQITypes.ml mQITypes.cmi EXTRA_OBJECTS_TO_CLEAN = mQueryTParser.ml mQueryTParser.mli \ mQueryTLexer.ml diff --git a/helm/ocaml/mathql_interpreter/mQIConn.mli b/helm/ocaml/mathql_interpreter/mQIConn.mli index 5e37f180a..c57674cc2 100644 --- a/helm/ocaml/mathql_interpreter/mQIConn.mli +++ b/helm/ocaml/mathql_interpreter/mQIConn.mli @@ -37,10 +37,9 @@ val init : ?flags:(flag list) -> ?log:(string -> unit) -> unit -> handle val close : handle -> unit val connected : handle -> bool val exec : handle -> - string -> string list -> - (bool * string * string list) list -> - (bool * string * string list) list list -> - string list list * string + MQITypes.table -> MQITypes.columns -> + string MQITypes.con_true -> string MQITypes.con_false -> + MQITypes.result * MQITypes.query val init_if_connected : ?flags:(flag list) -> ?log:(string -> unit) -> unit -> handle diff --git a/helm/ocaml/mathql_interpreter/mQIMySql.mli b/helm/ocaml/mathql_interpreter/mQIMySql.mli index 3cbae4dc5..c0102090a 100644 --- a/helm/ocaml/mathql_interpreter/mQIMySql.mli +++ b/helm/ocaml/mathql_interpreter/mQIMySql.mli @@ -31,8 +31,6 @@ val init : unit -> Mysql.dbd val close : Mysql.dbd -> unit val exec : Mysql.dbd -> - string -> string list -> - (bool * string * string list) list -> - (bool * string * string list) list list -> - string list list * string - + MQITypes.table -> MQITypes.columns -> + string MQITypes.con_true -> string MQITypes.con_false -> + MQITypes.result * MQITypes.query diff --git a/helm/ocaml/mathql_interpreter/mQIPostgres.mli b/helm/ocaml/mathql_interpreter/mQIPostgres.mli index 63752dfeb..afc75b051 100644 --- a/helm/ocaml/mathql_interpreter/mQIPostgres.mli +++ b/helm/ocaml/mathql_interpreter/mQIPostgres.mli @@ -31,12 +31,8 @@ val init : unit -> Postgres.connection val close : Postgres.connection -> unit val exec : Postgres.connection -> - string -> string list -> - (bool * string * string list) list -> - (bool * string * string list) list list -> - string list list * string - - - + MQITypes.table -> MQITypes.columns -> + string MQITypes.con_true -> string MQITypes.con_false -> + MQITypes.result * MQITypes.query diff --git a/helm/ocaml/mathql_interpreter/mQIProperty.mli b/helm/ocaml/mathql_interpreter/mQIProperty.mli index 1084cc94a..093447072 100644 --- a/helm/ocaml/mathql_interpreter/mQIProperty.mli +++ b/helm/ocaml/mathql_interpreter/mQIProperty.mli @@ -26,9 +26,7 @@ (* AUTOR: Ferruccio Guidi *) -open MathQL -open MQIConn +val exec: MQIConn.handle -> MathQL.refine -> MathQL.path -> + MathQL.path MQITypes.con_true -> MathQL.path MQITypes.con_false -> + MathQL.exp_list -> MathQL.result -val exec: handle -> refine -> path -> - (bool * path * value) list -> (bool * path * value) list list -> - exp_list -> result diff --git a/helm/ocaml/mathql_interpreter/mQITypes.ml b/helm/ocaml/mathql_interpreter/mQITypes.ml new file mode 100644 index 000000000..44b21ce18 --- /dev/null +++ b/helm/ocaml/mathql_interpreter/mQITypes.ml @@ -0,0 +1,41 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* AUTOR: Ferruccio Guidi + *) + +type 'a con = MathQL.pattern * 'a * MathQL.value + +type 'a con_true = 'a con list + +type 'a con_false = 'a con list list + +type table = string + +type columns = string list + +type result = string list list + +type query = string -- 2.39.2