From e1b2215f8df16ec48f634bf19d0f2e7e3305d189 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Wed, 19 Jul 2006 15:28:24 +0000 Subject: [PATCH] - added sql statements for querying forward and backward dependencies - escaped uri which get embedded in sql statements --- components/metadata/sqlStatements.ml | 10 ++++++++-- components/metadata/sqlStatements.mli | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/components/metadata/sqlStatements.ml b/components/metadata/sqlStatements.ml index 42fcebec0..5469aebb8 100644 --- a/components/metadata/sqlStatements.ml +++ b/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/components/metadata/sqlStatements.mli b/components/metadata/sqlStatements.mli index 90a6b64b4..72433c811 100644 --- a/components/metadata/sqlStatements.mli +++ b/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 + -- 2.39.2