]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/hmysql/hSql.ml
the edges must be quoted as well (not only the nodes)
[helm.git] / helm / software / components / hmysql / hSql.ml
index 329dd2205043bfaf97115f3ea877ae7bc8fe041d..ad2b5599373cea57a2839ab806f3c2f9b54ea5a0 100644 (file)
@@ -98,8 +98,7 @@ let exec (dbtype : dbtype) (dbd : dbd) (query : string) =
     debug_print (lazy ("EXEC: " ^ pp_dbtype dbtype ^ "|" ^ query));
     let dbd = List.assoc dbtype dbd in
     wrap (mk (HSqlite3.exec query) (HMysql.exec query)) dbd
-  with Not_found -> 
-    if dbtype = Legacy then Nothing else raise (Error "No ro or writable db")
+  with Not_found -> Nothing
 ;;
 
 let map result ~f = 
@@ -138,10 +137,13 @@ let mysql_err = function
 
 let errno dbtype dbd =
   wrap 
-    (fun d -> match List.assoc dbtype d with 
-    | Mysql dbd -> mysql_err (HMysql.errno dbd)
-    | Sqlite dbd -> sqlite_err (HSqlite3.errno dbd)
-    | FakeMySql -> assert false)
+    (fun d -> 
+    try
+      match List.assoc dbtype d with 
+      | Mysql dbd -> mysql_err (HMysql.errno dbd)
+      | Sqlite dbd -> sqlite_err (HSqlite3.errno dbd)
+      | FakeMySql -> assert false
+    with Not_found -> OK)
     dbd
 ;;
 
@@ -150,8 +152,7 @@ let escape dbtype dbd s =
       match List.assoc dbtype dbd with
       | Mysql _ | FakeMySql -> wrap HMysql.escape s
       | Sqlite _ -> wrap HSqlite3.escape s
-  with Not_found -> 
-    if dbtype = Legacy then s else raise (Error "No ro or writable db")
+  with Not_found -> s
 ;;
 
 let escape_string_for_like dbtype dbd = 
@@ -160,13 +161,15 @@ let escape_string_for_like dbtype dbd =
       | Mysql _ | FakeMySql -> HMysql.escape_string_for_like
       | Sqlite _ -> HSqlite3.escape_string_for_like
   with Not_found -> 
-    if dbtype = Legacy then ("ESCAPE \"\\\"" : ('a,'b,'c,'a) format4) 
-    else raise (Error "No ro or writable db")
+    ("ESCAPE \"\\\"" : ('a,'b,'c,'a) format4) 
 ;;
 
 let isMysql dbtype dbd =
   wrap 
-    (fun d -> match List.assoc dbtype d with Mysql _ -> true | _ -> false) 
+    (fun d -> 
+       try
+        match List.assoc dbtype d with Mysql _ -> true | _ -> false
+       with Not_found -> false) 
     dbd
 ;;