- ) MetadataConstraints.StringSet.empty l)
-(*
-let insert_const_no dbd uri =
- let term = CicUtil.term_of_uri uri in
- let ty = CicTypeChecker.type_of_aux'
- let inconcl_no =
- sprintf "INSERT %s SELECT \"%s\", COUNT(DISTINCT h_occurrence) FROM %s WHERE (h_position=\"%s\" OR h_position=\"%s\") AND source LIKE \"%s%%\""
- (conclno_tbl ()) uri (obj_tbl ()) inconcl_pos mainconcl_pos uri
- in
- let concl_hyp =
- sprintf "INSERT %s
- SELECT \"%s\",COUNT(DISTINCT h_occurrence)
- FROM %s
- WHERE NOT (h_position=\"%s\") AND (source = \"%s\")"
- (fullno_tbl ()) uri (obj_tbl ()) inbody_pos uri
- in
- ignore (Mysql.exec dbd inconcl_no);
- ignore (Mysql.exec dbd concl_hyp)
-*)
-let insert_const_no dbd (uri,metadata) =
- let no_concl = count_distinct `Conclusion metadata in
- let no_hyp = count_distinct `Hypothesis metadata in
- let no_full = count_distinct `Statement metadata in
- let insert =
- sprintf "INSERT INTO %s VALUES (\"%s\", %d, %d, %d)"
- (count_tbl ()) uri no_concl no_hyp no_full
- in
- ignore (Mysql.exec dbd insert)
+ ) MetadataConstraints.UriManagerSet.empty l)
+
+let insert_const_no ~dbd l =
+ let data =
+ List.fold_left
+ (fun acc (uri,_,metadata) ->
+ let no_concl = count_distinct `Conclusion metadata in
+ let no_hyp = count_distinct `Hypothesis metadata in
+ let no_full = count_distinct `Statement metadata in
+ (sprintf "(\"%s\", %d, %d, %d)"
+ (UriManager.string_of_uri uri) no_concl no_hyp no_full) :: acc
+ ) [] l in
+ let insert =
+ sprintf "INSERT INTO %s VALUES %s" (count_tbl ()) (String.concat "," data)
+ in
+ ignore (HMysql.exec dbd insert)