X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fhmysql%2FhMysql.ml;h=b9ace8e8321a9a38275002c6bdb383a8e86a27ef;hb=72cd94b68037956a70b98cfa54f316fd54e52bae;hp=041f4392287bf0642a1d50a20259d5efa8c110cb;hpb=ac741958783108ff31552e533c853e85c2ebb1c5;p=helm.git diff --git a/helm/software/components/hmysql/hMysql.ml b/helm/software/components/hmysql/hMysql.ml index 041f43922..b9ace8e83 100644 --- a/helm/software/components/hmysql/hMysql.ml +++ b/helm/software/components/hmysql/hMysql.ml @@ -35,22 +35,16 @@ type error_code = | No_such_index | Bad_table_error | GENERIC_ERROR of string -exception Error +exception Error of string let profiler = HExtlib.profile "mysql" -let use_real_db () = - not (Helm_registry.get_opt_default Helm_registry.bool - ~default:false "db.nodb") - let quick_connect ?host ?database ?port ?password ?user () = profiler.HExtlib.profile - (fun () -> - if use_real_db () then - (Some (Mysql.quick_connect ?host ?database ?port ?password ?user ())) - else - None) + (fun () -> + Some (Mysql.quick_connect ?host ?database ?port ?password ?user ())) () +;; let disconnect = function | None -> () @@ -59,13 +53,13 @@ let disconnect = function let escape s = profiler.HExtlib.profile Mysql.escape s -let exec dbd s = +let exec s dbd = match dbd with | None -> None | Some dbd -> try Some (profiler.HExtlib.profile (Mysql.exec dbd) s) - with Mysql.Error _ -> raise Error + with Mysql.Error s -> raise (Error s) let map res ~f = match res with @@ -88,7 +82,6 @@ let errno = function | Mysql.No_such_table -> No_such_table | Mysql.Table_exists_error -> Table_exists_error | Mysql.Dup_keyname -> Dup_keyname - | Mysql.No_such_table -> No_such_table | Mysql.No_such_index -> No_such_index | Mysql.Bad_table_error -> Bad_table_error | _ -> GENERIC_ERROR "Mysql_generic_error" @@ -96,3 +89,4 @@ let errno = function let isMysql = true +let escape_string_for_like = ("ESCAPE \"\\\\\"" : ('a,'b,'c,'a) format4);;