[tracker/sparql-update: 6/25] libtracker-data: Check for domain in support for REPLACE



commit 4e31a3411ed376fbfefb3f031949342634098c9a
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Mar 10 17:52:07 2011 +0100

    libtracker-data: Check for domain in support for REPLACE

 src/libtracker-data/tracker-data-update.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 6a31624..f1a2f21 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2659,6 +2659,14 @@ tracker_data_update_statement_with_uri (const gchar            *graph,
 		gboolean multiple_values;
 		GError *new_error = NULL;
 
+		if (!check_property_domain (property)) {
+			g_set_error (error, TRACKER_SPARQL_ERROR, TRACKER_SPARQL_ERROR_CONSTRAINT,
+			             "Subject `%s' is not in domain `%s' of property `%s'",
+			             resource_buffer->subject,
+			             tracker_class_get_name (tracker_property_get_domain (property)),
+			             tracker_property_get_name (property));
+		}
+
 		multiple_values = tracker_property_get_multiple_values (property);
 
 		/* We can disable correct object-id for deletes array here */
@@ -2777,6 +2785,14 @@ tracker_data_update_statement_with_string (const gchar            *graph,
 		return;
 	}
 
+	if (!check_property_domain (property)) {
+		g_set_error (error, TRACKER_SPARQL_ERROR, TRACKER_SPARQL_ERROR_CONSTRAINT,
+		             "Subject `%s' is not in domain `%s' of property `%s'",
+		             resource_buffer->subject,
+		             tracker_class_get_name (tracker_property_get_domain (property)),
+		             tracker_property_get_name (property));
+	}
+
 	/* add or update value to metadata database */
 	change = cache_update_metadata_decomposed (property, object, 0, graph, 0, &actual_error);
 	if (actual_error) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]