]> matita.cs.unibo.it Git - helm.git/blobdiff - components/hmysql/hSql.mli
maxipatch for support of multiple DBs.
[helm.git] / components / hmysql / hSql.mli
index fb678fa5942eaf4e024b929d781ebb8e94fc6f87..6cfc8865542da846ed8acd777b48ce68df62b811 100644 (file)
  * http://cs.unibo.it/helm/.
  *)
 
-(**
- * {2 Proxy module around MySQL conection}
- *
- * The behaviour of this module is influenced by the Helm_registry boolean value
- * of the "db.nodb" key. When set to "false" the module works as expected. When
- * set to "true" all functions perform dummy action: connect and disconnect do
- * nothing; exec, iter, and map work like the empty set of results has been
- * returned; errno and status return Mysql.Connection_error
- *)
-
 type dbd
 type result
 type error_code =
@@ -43,27 +33,38 @@ type error_code =
  | No_such_index
  | Bad_table_error
  | GENERIC_ERROR of string
+
 exception Error of string
 
 (* the exceptions raised are from the Mysql module *)
 
-val quick_connect :
-  ?host:string ->
-  ?database:string ->
-  ?port:int -> ?password:string -> ?user:string -> unit -> dbd
+type dbtype = User | Library | Legacy
+
+  (* host port dbname user password type *)
+type dbspec
+
+val mk_dbspec :
+  (string * int option * string * string * string option * dbtype) list ->
+    dbspec  
+
+val quick_connect : dbspec -> dbd
 
 val disconnect : dbd -> unit
 
-val exec: dbd -> string -> result
+val exec: dbtype -> dbd -> string -> result
 val map : result -> f:(string option array -> 'a) -> 'a list
 val iter : result -> f:(string option array -> unit) -> unit
 
 
-val errno : dbd -> error_code
+val errno : dbtype -> dbd -> error_code
 (* val status : dbd -> Mysql.status *)
 
-val escape: string -> string
+val escape: dbtype -> dbd -> string -> string
+
+val escape_string_for_like: dbtype -> dbd -> ('a,'b,'c,'a) format4
+
+val isMysql : dbtype -> dbd -> bool
 
-val escape_string_for_like: ('a,'b,'c,'a) format4
+(* this dbd can't du queries, used only in table_creator *)
+val fake_db_for_mysql: dbtype -> dbd
 
-val isMysql : bool