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



commit cab682123c31f96c0c7038aa47f6677bfb5fe1b5
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 fddaf9c..03a2a55 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2624,18 +2624,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) {
@@ -2643,8 +2636,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]