From: Stefano Zacchiroli Date: Wed, 19 Jul 2006 15:28:24 +0000 (+0000) Subject: - added sql statements for querying forward and backward dependencies X-Git-Tag: make_still_working~7040 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=39a3a05b745309703a5010d3da3e2a12c7228064;p=helm.git - added sql statements for querying forward and backward dependencies - escaped uri which get embedded in sql statements --- diff --git a/helm/software/components/metadata/sqlStatements.ml b/helm/software/components/metadata/sqlStatements.ml index 42fcebec0..5469aebb8 100644 --- a/helm/software/components/metadata/sqlStatements.ml +++ b/helm/software/components/metadata/sqlStatements.ml @@ -202,7 +202,13 @@ let move_content (name1, tbl1) (name2, tbl2) buri = assert (tbl1 = tbl2); sprintf "INSERT INTRO %s SELECT * FROM %s WHERE source LIKE \"%s%%\";" - name2 name1 buri + name2 name1 (HMysql.escape buri) +let direct_deps refObj uri = + sprintf "SELECT * FROM %s WHERE source = '%s';" + (HMysql.escape refObj) (UriManager.string_of_uri uri) + +let inverse_deps refObj uri = + sprintf "SELECT * FROM %s WHERE h_occurrence = '%s';" + (HMysql.escape refObj) (UriManager.string_of_uri uri) - diff --git a/helm/software/components/metadata/sqlStatements.mli b/helm/software/components/metadata/sqlStatements.mli index 90a6b64b4..72433c811 100644 --- a/helm/software/components/metadata/sqlStatements.mli +++ b/helm/software/components/metadata/sqlStatements.mli @@ -48,3 +48,11 @@ val fill_hits: string -> string -> string list * *) val move_content: (string * tbl) -> (string * tbl) -> string -> string +(** @param refObj name of the refObj table + * @param src uri of the desired 'source' field *) +val direct_deps: string -> UriManager.uri -> string + +(** @param refObj name of the refObj table + * @param src uri of the desired 'h_occurrence' field *) +val inverse_deps: string -> UriManager.uri -> string +