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



commit 791cacfc3f65eec5f423350ca5ff63665e8755bd
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 70484e3..fddaf9c 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2624,6 +2624,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 */
@@ -2742,6 +2750,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]