[tracker/sparql-update: 7/16] libtracker-data: get_old_property_values already does domain check here



commit 2b262e978ee7227b2a885cf2de54c18a10057e09
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Mar 10 17:55:49 2011 +0100

    libtracker-data: get_old_property_values already does domain check here

 src/libtracker-data/tracker-data-update.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 67e95ad..735d859 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2620,18 +2620,11 @@ 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 */
 		if (!multiple_values) {
+			/* This does a check_property_domain too */
 			old_values = get_old_property_values (property, &new_error);
 			if (!new_error) {
 				if (old_values->n_values > 0) {
@@ -2639,8 +2632,16 @@ tracker_data_update_statement_with_uri (const gchar            *graph,
 					old_object_id = (guint) g_value_get_int64 (g_value_array_get_nth (old_values, 0));
 				}
 			} else {
-				g_warning ("%s", new_error->message);
-				g_clear_error (&new_error);
+				g_propagate_error (error, new_error);
+				return;
+			}
+		} else {
+			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));
 			}
 		}
 



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