[tracker/IorR-null-support: 3/12] libtracker-data: Add stops and error handling for unsupported null cases
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/IorR-null-support: 3/12] libtracker-data: Add stops and error handling for unsupported null cases
- Date: Mon, 15 Aug 2011 14:09:18 +0000 (UTC)
commit bb49d750a68978f71fe4ef768f09f28dd1a22226
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Aug 9 15:28:16 2011 +0200
libtracker-data: Add stops and error handling for unsupported null cases
src/libtracker-data/tracker-data-update.c | 7 +++++++
src/libtracker-data/tracker-sparql-query.vala | 16 +++++++++++++++-
2 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index c252455..ddc6b51 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -3071,6 +3071,13 @@ tracker_data_update_statement (const gchar *graph,
property = tracker_ontologies_get_property_by_uri (predicate);
if (property != NULL) {
if (object == NULL) {
+
+ if (property == tracker_ontologies_get_rdf_type ()) {
+ g_set_error (error, TRACKER_SPARQL_ERROR, TRACKER_SPARQL_ERROR_UNSUPPORTED,
+ "Using 'null' with '%s' is not supported", predicate);
+ return;
+ }
+
delete_all_objects (graph, subject, predicate, error);
} else {
if (tracker_property_get_data_type (property) == TRACKER_PROPERTY_TYPE_RESOURCE) {
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index 3040b13..056719e 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -755,16 +755,25 @@ public class Tracker.Sparql.Query : Object {
expect (SparqlTokenType.OPEN_BRACE);
while (current () != SparqlTokenType.CLOSE_BRACE) {
- bool is_null; // ignored
+ bool is_null = false;
if (accept (SparqlTokenType.GRAPH)) {
var old_graph = current_graph;
current_graph = parse_construct_var_or_term (var_value_map, out is_null);
+ if (is_null) {
+ throw get_error ("'null' not supported for graph");
+ }
+
expect (SparqlTokenType.OPEN_BRACE);
while (current () != SparqlTokenType.CLOSE_BRACE) {
current_subject = parse_construct_var_or_term (var_value_map, out is_null);
+
+ if (is_null) {
+ throw get_error ("'null' not supported for subject");
+ }
+
parse_construct_property_list_not_empty (var_value_map);
if (!accept (SparqlTokenType.DOT)) {
// no triples following
@@ -779,6 +788,11 @@ public class Tracker.Sparql.Query : Object {
accept (SparqlTokenType.DOT);
} else {
current_subject = parse_construct_var_or_term (var_value_map, out is_null);
+
+ if (is_null) {
+ throw get_error ("'null' not supported for subject");
+ }
+
parse_construct_property_list_not_empty (var_value_map);
if (!accept (SparqlTokenType.DOT) && current () != SparqlTokenType.GRAPH) {
// neither GRAPH nor triples following
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]