[tracker/direct-access: 91/121] Move SparqlError from libtracker-data to libtracker-sparql
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/direct-access: 91/121] Move SparqlError from libtracker-data to libtracker-sparql
- Date: Thu, 22 Jul 2010 14:50:12 +0000 (UTC)
commit 1aa0960a607c3386d6c9a0304fa679595edc3e1d
Author: Jürg Billeter <j bitron ch>
Date: Wed Jul 21 15:55:05 2010 +0200
Move SparqlError from libtracker-data to libtracker-sparql
src/libtracker-bus/tracker-bus-fd-cursor.c | 1 +
src/libtracker-bus/tracker-bus-fd-cursor.vapi | 2 +-
src/libtracker-bus/tracker-bus.vala | 93 ++++++++++++-------
src/libtracker-data/Makefile.am | 2 +-
src/libtracker-data/tracker-sparql-expression.vala | 66 +++++++-------
src/libtracker-data/tracker-sparql-pattern.vala | 44 +++++-----
src/libtracker-data/tracker-sparql-query.vala | 75 +++++++---------
src/libtracker-data/tracker-sparql-scanner.vala | 18 ++--
src/libtracker-data/tracker-turtle-reader.vala | 16 ++--
src/libtracker-direct/tracker-direct.vala | 18 +++--
src/libtracker-sparql/tracker-connection.vala | 33 +++++---
src/libtracker-sparql/tracker-plugin-loader.vala | 28 ++++---
src/tracker-store/Makefile.am | 1 +
tests/libtracker-data/Makefile.am | 1 +
tests/libtracker-fts/Makefile.am | 1 +
utils/services/Makefile.am | 1 +
16 files changed, 220 insertions(+), 180 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-bus-fd-cursor.c b/src/libtracker-bus/tracker-bus-fd-cursor.c
index 034d0dd..de3784f 100644
--- a/src/libtracker-bus/tracker-bus-fd-cursor.c
+++ b/src/libtracker-bus/tracker-bus-fd-cursor.c
@@ -31,6 +31,7 @@
#include <libtracker-sparql/tracker-sparql.h>
#include "tracker-bus.h"
+#include "tracker-bus-fd-cursor.h"
#ifdef HAVE_DBUS_FD_PASSING
diff --git a/src/libtracker-bus/tracker-bus-fd-cursor.vapi b/src/libtracker-bus/tracker-bus-fd-cursor.vapi
index dc6cf8c..20482ac 100644
--- a/src/libtracker-bus/tracker-bus-fd-cursor.vapi
+++ b/src/libtracker-bus/tracker-bus-fd-cursor.vapi
@@ -18,4 +18,4 @@
*/
[CCode (cheader_filename = "libtracker-bus/tracker-bus-fd-cursor.h")]
-public async Tracker.Sparql.Cursor tracker_bus_fd_query_async (DBus.Connection connection, string query) throws GLib.Error;
+public async Tracker.Sparql.Cursor tracker_bus_fd_query_async (DBus.Connection connection, string query) throws DBus.Error;
diff --git a/src/libtracker-bus/tracker-bus.vala b/src/libtracker-bus/tracker-bus.vala
index 01e0c86..6433e9c 100644
--- a/src/libtracker-bus/tracker-bus.vala
+++ b/src/libtracker-bus/tracker-bus.vala
@@ -42,7 +42,7 @@ private interface Tracker.Bus.Statistics : GLib.Object {
}
// Imported DBus FD API until we have support with Vala
-public extern Tracker.Sparql.Cursor tracker_bus_fd_query (DBus.Connection connection, string query) throws GLib.Error;
+public extern Tracker.Sparql.Cursor tracker_bus_fd_query (DBus.Connection connection, string query) throws Tracker.Sparql.Error;
// Actual class definition
public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
@@ -81,54 +81,79 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
initialized = false;
}
- public override Sparql.Cursor? query (string sparql, Cancellable? cancellable) throws GLib.Error {
- // FIXME: Decide between FD passing and DBus-Glib, we need to do this
- // here because otherwise we need to do the whole set up of their
- // DBus interface again in the .c file, which is pointless when
- // one call can do it here just fine.
- //
- // Really we need #ifdef here, unsupported in vala AFAIK
-
- if (use_steroids) {
- return tracker_bus_fd_query (connection, sparql);
- } else {
- string[,] results = resources_object.sparql_query (sparql);
- return new Tracker.Bus.ArrayCursor ((owned) results, results.length[0], results.length[1]);
+ public override Sparql.Cursor? query (string sparql, Cancellable? cancellable) throws Sparql.Error {
+ try {
+ if (use_steroids) {
+ return tracker_bus_fd_query (connection, sparql);
+ } else {
+ string[,] results = resources_object.sparql_query (sparql);
+ return new Tracker.Bus.ArrayCursor ((owned) results, results.length[0], results.length[1]);
+ }
+ } catch (DBus.Error e) {
+ throw new Sparql.Error.INTERNAL (e.message);
}
}
- public async override Sparql.Cursor? query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error {
- if (use_steroids) {
- return yield tracker_bus_fd_query_async (connection, sparql);
- } else {
- string[,] results = yield resources_object.sparql_query_async (sparql);
- return new Tracker.Bus.ArrayCursor ((owned) results, results.length[0], results.length[1]);
+ public async override Sparql.Cursor? query_async (string sparql, Cancellable? cancellable = null) throws Sparql.Error {
+ try {
+ if (use_steroids) {
+ return yield tracker_bus_fd_query_async (connection, sparql);
+ } else {
+ string[,] results = yield resources_object.sparql_query_async (sparql);
+ return new Tracker.Bus.ArrayCursor ((owned) results, results.length[0], results.length[1]);
+ }
+ } catch (DBus.Error e) {
+ throw new Sparql.Error.INTERNAL (e.message);
}
}
- public override void update (string sparql, Cancellable? cancellable = null) throws GLib.Error {
- resources_object.sparql_update (sparql);
+ public override void update (string sparql, Cancellable? cancellable = null) throws Sparql.Error {
+ try {
+ resources_object.sparql_update (sparql);
+ } catch (DBus.Error e) {
+ throw new Sparql.Error.INTERNAL (e.message);
+ }
}
- public async override void update_async (string sparql, int? priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws GLib.Error {
- yield resources_object.sparql_update_async (sparql);
+ public async override void update_async (string sparql, int? priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error {
+ try {
+ yield resources_object.sparql_update_async (sparql);
+ } catch (DBus.Error e) {
+ throw new Sparql.Error.INTERNAL (e.message);
+ }
}
- public override void import (File file, Cancellable? cancellable = null) throws GLib.Error {
- resources_object.import (file.get_uri ());
+ public override void import (File file, Cancellable? cancellable = null) throws Sparql.Error {
+ try {
+ resources_object.import (file.get_uri ());
+ } catch (DBus.Error e) {
+ throw new Sparql.Error.INTERNAL (e.message);
+ }
}
- public async override void import_async (File file, Cancellable? cancellable = null) throws GLib.Error {
- yield resources_object.import_async (file.get_uri ());
+ public async override void import_async (File file, Cancellable? cancellable = null) throws Sparql.Error {
+ try {
+ yield resources_object.import_async (file.get_uri ());
+ } catch (DBus.Error e) {
+ throw new Sparql.Error.INTERNAL (e.message);
+ }
}
- public override Sparql.Cursor? statistics (Cancellable? cancellable = null) throws GLib.Error {
- string[,] results = statistics_object.Get ();
- return new Tracker.Bus.ArrayCursor ((owned) results, results.length[0], results.length[1]);
+ public override Sparql.Cursor? statistics (Cancellable? cancellable = null) throws Sparql.Error {
+ try {
+ string[,] results = statistics_object.Get ();
+ return new Tracker.Bus.ArrayCursor ((owned) results, results.length[0], results.length[1]);
+ } catch (DBus.Error e) {
+ throw new Sparql.Error.INTERNAL (e.message);
+ }
}
- public async override Sparql.Cursor? statistics_async (Cancellable? cancellable = null) throws GLib.Error {
- string[,] results = yield statistics_object.Get_async ();
- return new Tracker.Bus.ArrayCursor ((owned) results, results.length[0], results.length[1]);
+ public async override Sparql.Cursor? statistics_async (Cancellable? cancellable = null) throws Sparql.Error {
+ try {
+ string[,] results = yield statistics_object.Get_async ();
+ return new Tracker.Bus.ArrayCursor ((owned) results, results.length[0], results.length[1]);
+ } catch (DBus.Error e) {
+ throw new Sparql.Error.INTERNAL (e.message);
+ }
}
}
diff --git a/src/libtracker-data/Makefile.am b/src/libtracker-data/Makefile.am
index b691983..d458fbe 100644
--- a/src/libtracker-data/Makefile.am
+++ b/src/libtracker-data/Makefile.am
@@ -6,7 +6,7 @@ INCLUDES = \
-DTRACKER_COMPILATION \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
- -I$(top_builddir)/src/libtracker-client \
+ -I$(top_builddir)/src/libtracker-sparql \
$(WARN_CFLAGS) \
$(GLIB2_CFLAGS) \
$(DBUS_CFLAGS) \
diff --git a/src/libtracker-data/tracker-sparql-expression.vala b/src/libtracker-data/tracker-sparql-expression.vala
index ea5052f..601f46f 100644
--- a/src/libtracker-data/tracker-sparql-expression.vala
+++ b/src/libtracker-data/tracker-sparql-expression.vala
@@ -37,7 +37,7 @@ class Tracker.Sparql.Expression : Object {
get { return query.pattern; }
}
- inline bool next () throws SparqlError {
+ inline bool next () throws Sparql.Error {
return query.next ();
}
@@ -49,15 +49,15 @@ class Tracker.Sparql.Expression : Object {
return query.last ();
}
- inline bool accept (SparqlTokenType type) throws SparqlError {
+ inline bool accept (SparqlTokenType type) throws Sparql.Error {
return query.accept (type);
}
- SparqlError get_error (string msg) {
+ Sparql.Error get_error (string msg) {
return query.get_error (msg);
}
- bool expect (SparqlTokenType type) throws SparqlError {
+ bool expect (SparqlTokenType type) throws Sparql.Error {
return query.expect (type);
}
@@ -73,7 +73,7 @@ class Tracker.Sparql.Expression : Object {
return (type == PropertyType.INTEGER || type == PropertyType.DOUBLE || type == PropertyType.DATETIME || type == PropertyType.UNKNOWN);
}
- void skip_bracketted_expression () throws SparqlError {
+ void skip_bracketted_expression () throws Sparql.Error {
expect (SparqlTokenType.OPEN_PARENS);
while (true) {
switch (current ()) {
@@ -93,7 +93,7 @@ class Tracker.Sparql.Expression : Object {
expect (SparqlTokenType.CLOSE_PARENS);
}
- internal void skip_select_variables () throws SparqlError {
+ internal void skip_select_variables () throws Sparql.Error {
while (true) {
switch (current ()) {
case SparqlTokenType.OPEN_PARENS:
@@ -116,7 +116,7 @@ class Tracker.Sparql.Expression : Object {
}
}
- internal PropertyType translate_select_expression (StringBuilder sql, bool subquery) throws SparqlError {
+ internal PropertyType translate_select_expression (StringBuilder sql, bool subquery) throws Sparql.Error {
Variable variable = null;
long begin = sql.len;
@@ -171,7 +171,7 @@ class Tracker.Sparql.Expression : Object {
return type;
}
- void translate_expression_as_order_condition (StringBuilder sql) throws SparqlError {
+ void translate_expression_as_order_condition (StringBuilder sql) throws Sparql.Error {
long begin = sql.len;
if (translate_expression (sql) == PropertyType.RESOURCE) {
// ID => Uri
@@ -180,7 +180,7 @@ class Tracker.Sparql.Expression : Object {
}
}
- internal void translate_order_condition (StringBuilder sql) throws SparqlError {
+ internal void translate_order_condition (StringBuilder sql) throws Sparql.Error {
if (accept (SparqlTokenType.ASC)) {
translate_expression_as_order_condition (sql);
sql.append (" ASC");
@@ -192,7 +192,7 @@ class Tracker.Sparql.Expression : Object {
}
}
- void translate_bound_call (StringBuilder sql) throws SparqlError {
+ void translate_bound_call (StringBuilder sql) throws Sparql.Error {
expect (SparqlTokenType.BOUND);
expect (SparqlTokenType.OPEN_PARENS);
sql.append ("(");
@@ -201,7 +201,7 @@ class Tracker.Sparql.Expression : Object {
expect (SparqlTokenType.CLOSE_PARENS);
}
- void translate_regex (StringBuilder sql) throws SparqlError {
+ void translate_regex (StringBuilder sql) throws Sparql.Error {
expect (SparqlTokenType.REGEX);
expect (SparqlTokenType.OPEN_PARENS);
sql.append ("SparqlRegex(");
@@ -259,7 +259,7 @@ class Tracker.Sparql.Expression : Object {
}
}
- void translate_expression_as_string (StringBuilder sql) throws SparqlError {
+ void translate_expression_as_string (StringBuilder sql) throws Sparql.Error {
switch (current ()) {
case SparqlTokenType.IRI_REF:
case SparqlTokenType.PN_PREFIX:
@@ -287,7 +287,7 @@ class Tracker.Sparql.Expression : Object {
}
}
- void translate_str (StringBuilder sql) throws SparqlError {
+ void translate_str (StringBuilder sql) throws Sparql.Error {
expect (SparqlTokenType.STR);
expect (SparqlTokenType.OPEN_PARENS);
@@ -296,7 +296,7 @@ class Tracker.Sparql.Expression : Object {
expect (SparqlTokenType.CLOSE_PARENS);
}
- void translate_isuri (StringBuilder sql) throws SparqlError {
+ void translate_isuri (StringBuilder sql) throws Sparql.Error {
if (!accept (SparqlTokenType.ISURI)) {
expect (SparqlTokenType.ISIRI);
}
@@ -321,7 +321,7 @@ class Tracker.Sparql.Expression : Object {
expect (SparqlTokenType.CLOSE_PARENS);
}
- void translate_datatype (StringBuilder sql) throws SparqlError {
+ void translate_datatype (StringBuilder sql) throws Sparql.Error {
expect (SparqlTokenType.DATATYPE);
expect (SparqlTokenType.OPEN_PARENS);
@@ -350,7 +350,7 @@ class Tracker.Sparql.Expression : Object {
expect (SparqlTokenType.CLOSE_PARENS);
}
- PropertyType translate_function (StringBuilder sql, string uri) throws SparqlError {
+ PropertyType translate_function (StringBuilder sql, string uri) throws Sparql.Error {
if (uri == XSD_NS + "string") {
// conversion to string
translate_expression_as_string (sql);
@@ -657,7 +657,7 @@ class Tracker.Sparql.Expression : Object {
}
}
- PropertyType parse_type_uri () throws SparqlError {
+ PropertyType parse_type_uri () throws Sparql.Error {
string type_iri;
PropertyType type;
@@ -701,7 +701,7 @@ class Tracker.Sparql.Expression : Object {
return type;
}
- internal string parse_string_literal (out PropertyType type = null) throws SparqlError {
+ internal string parse_string_literal (out PropertyType type = null) throws Sparql.Error {
next ();
switch (last ()) {
case SparqlTokenType.STRING_LITERAL1:
@@ -776,7 +776,7 @@ class Tracker.Sparql.Expression : Object {
}
}
- PropertyType translate_uri_expression (StringBuilder sql, string uri) throws SparqlError {
+ PropertyType translate_uri_expression (StringBuilder sql, string uri) throws Sparql.Error {
if (accept (SparqlTokenType.OPEN_PARENS)) {
// function
var result = translate_function (sql, uri);
@@ -792,7 +792,7 @@ class Tracker.Sparql.Expression : Object {
}
}
- PropertyType translate_primary_expression (StringBuilder sql) throws SparqlError {
+ PropertyType translate_primary_expression (StringBuilder sql) throws Sparql.Error {
PropertyType type;
switch (current ()) {
@@ -976,7 +976,7 @@ class Tracker.Sparql.Expression : Object {
}
}
- PropertyType translate_unary_expression (StringBuilder sql) throws SparqlError {
+ PropertyType translate_unary_expression (StringBuilder sql) throws Sparql.Error {
if (accept (SparqlTokenType.OP_NEG)) {
sql.append ("NOT (");
var optype = translate_primary_expression (sql);
@@ -996,7 +996,7 @@ class Tracker.Sparql.Expression : Object {
return translate_primary_expression (sql);
}
- PropertyType translate_multiplicative_expression (StringBuilder sql) throws SparqlError {
+ PropertyType translate_multiplicative_expression (StringBuilder sql) throws Sparql.Error {
long begin = sql.len;
var optype = translate_unary_expression (sql);
while (true) {
@@ -1027,7 +1027,7 @@ class Tracker.Sparql.Expression : Object {
return optype;
}
- PropertyType translate_additive_expression (StringBuilder sql) throws SparqlError {
+ PropertyType translate_additive_expression (StringBuilder sql) throws Sparql.Error {
long begin = sql.len;
var optype = translate_multiplicative_expression (sql);
while (true) {
@@ -1058,11 +1058,11 @@ class Tracker.Sparql.Expression : Object {
return optype;
}
- PropertyType translate_numeric_expression (StringBuilder sql) throws SparqlError {
+ PropertyType translate_numeric_expression (StringBuilder sql) throws Sparql.Error {
return translate_additive_expression (sql);
}
- PropertyType process_relational_expression (StringBuilder sql, long begin, uint n_bindings, PropertyType op1type, string operator) throws SparqlError {
+ PropertyType process_relational_expression (StringBuilder sql, long begin, uint n_bindings, PropertyType op1type, string operator) throws Sparql.Error {
sql.insert (begin, "(");
sql.append (operator);
var op2type = translate_numeric_expression (sql);
@@ -1078,7 +1078,7 @@ class Tracker.Sparql.Expression : Object {
return PropertyType.BOOLEAN;
}
- PropertyType translate_relational_expression (StringBuilder sql) throws SparqlError {
+ PropertyType translate_relational_expression (StringBuilder sql) throws Sparql.Error {
long begin = sql.len;
// TODO: improve performance (linked list)
uint n_bindings = query.bindings.length ();
@@ -1099,11 +1099,11 @@ class Tracker.Sparql.Expression : Object {
return optype;
}
- PropertyType translate_value_logical (StringBuilder sql) throws SparqlError {
+ PropertyType translate_value_logical (StringBuilder sql) throws Sparql.Error {
return translate_relational_expression (sql);
}
- PropertyType translate_conditional_and_expression (StringBuilder sql) throws SparqlError {
+ PropertyType translate_conditional_and_expression (StringBuilder sql) throws Sparql.Error {
long begin = sql.len;
var optype = translate_value_logical (sql);
while (accept (SparqlTokenType.OP_AND)) {
@@ -1121,7 +1121,7 @@ class Tracker.Sparql.Expression : Object {
return optype;
}
- PropertyType translate_conditional_or_expression (StringBuilder sql) throws SparqlError {
+ PropertyType translate_conditional_or_expression (StringBuilder sql) throws Sparql.Error {
long begin = sql.len;
var optype = translate_conditional_and_expression (sql);
while (accept (SparqlTokenType.OP_OR)) {
@@ -1139,11 +1139,11 @@ class Tracker.Sparql.Expression : Object {
return optype;
}
- internal PropertyType translate_expression (StringBuilder sql) throws SparqlError {
+ internal PropertyType translate_expression (StringBuilder sql) throws Sparql.Error {
return translate_conditional_or_expression (sql);
}
- PropertyType translate_bracketted_expression (StringBuilder sql) throws SparqlError {
+ PropertyType translate_bracketted_expression (StringBuilder sql) throws Sparql.Error {
expect (SparqlTokenType.OPEN_PARENS);
if (current () == SparqlTokenType.SELECT) {
@@ -1162,7 +1162,7 @@ class Tracker.Sparql.Expression : Object {
return optype;
}
- PropertyType translate_aggregate_expression (StringBuilder sql) throws SparqlError {
+ PropertyType translate_aggregate_expression (StringBuilder sql) throws Sparql.Error {
expect (SparqlTokenType.OPEN_PARENS);
if (accept (SparqlTokenType.DISTINCT)) {
sql.append ("DISTINCT ");
@@ -1172,7 +1172,7 @@ class Tracker.Sparql.Expression : Object {
return optype;
}
- internal PropertyType translate_constraint (StringBuilder sql) throws SparqlError {
+ internal PropertyType translate_constraint (StringBuilder sql) throws Sparql.Error {
switch (current ()) {
case SparqlTokenType.STR:
case SparqlTokenType.LANG:
diff --git a/src/libtracker-data/tracker-sparql-pattern.vala b/src/libtracker-data/tracker-sparql-pattern.vala
index fa4b1f1..f94da4d 100644
--- a/src/libtracker-data/tracker-sparql-pattern.vala
+++ b/src/libtracker-data/tracker-sparql-pattern.vala
@@ -26,7 +26,7 @@ namespace Tracker.Sparql {
public Class? domain;
- public string get_sql_query (Query query) throws SparqlError {
+ public string get_sql_query (Query query) throws Sparql.Error {
try {
var sql = new StringBuilder ();
@@ -142,7 +142,7 @@ namespace Tracker.Sparql {
}
return sql.str;
} catch (DBInterfaceError e) {
- throw new SparqlError.INTERNAL (e.message);
+ throw new Sparql.Error.INTERNAL (e.message);
}
}
}
@@ -173,7 +173,7 @@ class Tracker.Sparql.Pattern : Object {
set { query.context = value; }
}
- inline bool next () throws SparqlError {
+ inline bool next () throws Sparql.Error {
return query.next ();
}
@@ -181,15 +181,15 @@ class Tracker.Sparql.Pattern : Object {
return query.current ();
}
- inline bool accept (SparqlTokenType type) throws SparqlError {
+ inline bool accept (SparqlTokenType type) throws Sparql.Error {
return query.accept (type);
}
- SparqlError get_error (string msg) {
+ Sparql.Error get_error (string msg) {
return query.get_error (msg);
}
- bool expect (SparqlTokenType type) throws SparqlError {
+ bool expect (SparqlTokenType type) throws Sparql.Error {
return query.expect (type);
}
@@ -230,7 +230,7 @@ class Tracker.Sparql.Pattern : Object {
TripleContext? triple_context;
- internal SelectContext translate_select (StringBuilder sql, bool subquery = false, bool scalar_subquery = false) throws SparqlError {
+ internal SelectContext translate_select (StringBuilder sql, bool subquery = false, bool scalar_subquery = false) throws Sparql.Error {
SelectContext result;
if (scalar_subquery) {
result = new SelectContext.subquery (context);
@@ -416,7 +416,7 @@ class Tracker.Sparql.Pattern : Object {
return result;
}
- internal string parse_var_or_term (StringBuilder? sql, out bool is_var) throws SparqlError {
+ internal string parse_var_or_term (StringBuilder? sql, out bool is_var) throws Sparql.Error {
string result = "";
is_var = false;
if (current () == SparqlTokenType.VAR) {
@@ -486,7 +486,7 @@ class Tracker.Sparql.Pattern : Object {
return result;
}
- void parse_object_list (StringBuilder sql, bool in_simple_optional = false) throws SparqlError {
+ void parse_object_list (StringBuilder sql, bool in_simple_optional = false) throws Sparql.Error {
while (true) {
parse_object (sql, in_simple_optional);
if (accept (SparqlTokenType.COMMA)) {
@@ -496,7 +496,7 @@ class Tracker.Sparql.Pattern : Object {
}
}
- void parse_property_list_not_empty (StringBuilder sql, bool in_simple_optional = false) throws SparqlError {
+ void parse_property_list_not_empty (StringBuilder sql, bool in_simple_optional = false) throws Sparql.Error {
while (true) {
var old_predicate = current_predicate;
var old_predicate_is_var = current_predicate_is_var;
@@ -540,12 +540,12 @@ class Tracker.Sparql.Pattern : Object {
}
}
- void translate_filter (StringBuilder sql) throws SparqlError {
+ void translate_filter (StringBuilder sql) throws Sparql.Error {
expect (SparqlTokenType.FILTER);
expression.translate_constraint (sql);
}
- void skip_filter () throws SparqlError {
+ void skip_filter () throws Sparql.Error {
expect (SparqlTokenType.FILTER);
switch (current ()) {
@@ -582,13 +582,13 @@ class Tracker.Sparql.Pattern : Object {
}
}
- void start_triples_block (StringBuilder sql) throws SparqlError {
+ void start_triples_block (StringBuilder sql) throws Sparql.Error {
context = triple_context = new TripleContext (context);
sql.append ("SELECT ");
}
- void end_triples_block (StringBuilder sql, ref bool first_where, bool in_group_graph_pattern) throws SparqlError {
+ void end_triples_block (StringBuilder sql, ref bool first_where, bool in_group_graph_pattern) throws Sparql.Error {
// remove last comma and space
sql.truncate (sql.len - 2);
@@ -686,7 +686,7 @@ class Tracker.Sparql.Pattern : Object {
context = context.parent_context;
}
- void parse_triples (StringBuilder sql, long group_graph_pattern_start, ref bool in_triples_block, ref bool first_where, ref bool in_group_graph_pattern, bool found_simple_optional) throws SparqlError {
+ void parse_triples (StringBuilder sql, long group_graph_pattern_start, ref bool in_triples_block, ref bool first_where, ref bool in_group_graph_pattern, bool found_simple_optional) throws Sparql.Error {
while (true) {
if (current () != SparqlTokenType.VAR &&
current () != SparqlTokenType.IRI_REF &&
@@ -809,7 +809,7 @@ class Tracker.Sparql.Pattern : Object {
// no match
return false;
- } catch (SparqlError e) {
+ } catch (Sparql.Error e) {
return false;
} finally {
// in any case, go back to the start of the optional
@@ -817,7 +817,7 @@ class Tracker.Sparql.Pattern : Object {
}
}
- internal Context translate_group_graph_pattern (StringBuilder sql) throws SparqlError {
+ internal Context translate_group_graph_pattern (StringBuilder sql) throws Sparql.Error {
expect (SparqlTokenType.OPEN_BRACE);
if (current () == SparqlTokenType.SELECT) {
@@ -1044,7 +1044,7 @@ class Tracker.Sparql.Pattern : Object {
return result;
}
- void translate_group_or_union_graph_pattern (StringBuilder sql) throws SparqlError {
+ void translate_group_or_union_graph_pattern (StringBuilder sql) throws Sparql.Error {
Variable[] all_vars = { };
HashTable<Variable,int> all_var_set = new HashTable<Variable,int>.full (direct_hash, direct_equal, g_object_unref, null);
@@ -1164,7 +1164,7 @@ class Tracker.Sparql.Pattern : Object {
}
}
- void parse_object (StringBuilder sql, bool in_simple_optional = false) throws SparqlError {
+ void parse_object (StringBuilder sql, bool in_simple_optional = false) throws Sparql.Error {
bool object_is_var;
string object = parse_var_or_term (sql, out object_is_var);
@@ -1188,7 +1188,7 @@ class Tracker.Sparql.Pattern : Object {
rdftype = true;
var cl = Ontologies.get_class_by_uri (object);
if (cl == null) {
- throw new SparqlError.UNKNOWN_CLASS ("Unknown class `%s'".printf (object));
+ throw new Sparql.Error.UNKNOWN_CLASS ("Unknown class `%s'".printf (object));
}
db_table = cl.name;
subject_type = cl;
@@ -1199,7 +1199,7 @@ class Tracker.Sparql.Pattern : Object {
share_table = false;
is_fts_match = true;
} else {
- throw new SparqlError.UNKNOWN_PROPERTY ("Unknown property `%s'".printf (current_predicate));
+ throw new Sparql.Error.UNKNOWN_PROPERTY ("Unknown property `%s'".printf (current_predicate));
}
} else {
if (current_predicate == "http://www.w3.org/2000/01/rdf-schema#domain"
@@ -1208,7 +1208,7 @@ class Tracker.Sparql.Pattern : Object {
// rdfs:domain
var domain = Ontologies.get_class_by_uri (object);
if (domain == null) {
- throw new SparqlError.UNKNOWN_CLASS ("Unknown class `%s'".printf (object));
+ throw new Sparql.Error.UNKNOWN_CLASS ("Unknown class `%s'".printf (object));
}
var pv = context.predicate_variable_map.lookup (context.get_variable (current_subject));
if (pv == null) {
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index c4a2d9e..fef92a9 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -17,15 +17,6 @@
* Boston, MA 02110-1301, USA.
*/
-public errordomain Tracker.SparqlError {
- PARSE,
- UNKNOWN_CLASS,
- UNKNOWN_PROPERTY,
- TYPE,
- INTERNAL,
- UNSUPPORTED
-}
-
namespace Tracker.Sparql {
enum VariableState {
NONE,
@@ -291,7 +282,7 @@ public class Tracker.Sparql.Query : Object {
}
}
- internal bool next () throws SparqlError {
+ internal bool next () throws Sparql.Error {
index = (index + 1) % BUFFER_SIZE;
size--;
if (size <= 0) {
@@ -314,7 +305,7 @@ public class Tracker.Sparql.Query : Object {
return tokens[last_index].type;
}
- internal bool accept (SparqlTokenType type) throws SparqlError {
+ internal bool accept (SparqlTokenType type) throws Sparql.Error {
if (current () == type) {
next ();
return true;
@@ -322,15 +313,15 @@ public class Tracker.Sparql.Query : Object {
return false;
}
- internal SparqlError get_error (string msg) {
- return new SparqlError.PARSE ("%d.%d: syntax error, %s".printf (tokens[index].begin.line, tokens[index].begin.column, msg));
+ internal Sparql.Error get_error (string msg) {
+ return new Sparql.Error.PARSE ("%d.%d: syntax error, %s".printf (tokens[index].begin.line, tokens[index].begin.column, msg));
}
- internal SparqlError get_internal_error (string msg) {
- return new SparqlError.INTERNAL ("%d.%d: %s".printf (tokens[index].begin.line, tokens[index].begin.column, msg));
+ internal Sparql.Error get_internal_error (string msg) {
+ return new Sparql.Error.INTERNAL ("%d.%d: %s".printf (tokens[index].begin.line, tokens[index].begin.column, msg));
}
- internal bool expect (SparqlTokenType type) throws SparqlError {
+ internal bool expect (SparqlTokenType type) throws Sparql.Error {
if (accept (type)) {
return true;
}
@@ -348,7 +339,7 @@ public class Tracker.Sparql.Query : Object {
index = 0;
try {
next ();
- } catch (SparqlError e) {
+ } catch (Sparql.Error e) {
// this should never happen as this is the second time we scan this token
critical ("internal error: next in set_location failed");
}
@@ -359,7 +350,7 @@ public class Tracker.Sparql.Query : Object {
return ((string) (tokens[last_index].begin.pos + strip)).ndup ((tokens[last_index].end.pos - tokens[last_index].begin.pos - 2 * strip));
}
- void parse_prologue () throws SparqlError {
+ void parse_prologue () throws Sparql.Error {
if (accept (SparqlTokenType.BASE)) {
expect (SparqlTokenType.IRI_REF);
}
@@ -375,7 +366,7 @@ public class Tracker.Sparql.Query : Object {
}
}
- void prepare_execute () throws DBInterfaceError, SparqlError, DateError {
+ void prepare_execute () throws DBInterfaceError, Sparql.Error, DateError {
assert (!update_extensions);
scanner = new SparqlScanner ((char*) query_string, (long) query_string.size ());
@@ -395,7 +386,7 @@ public class Tracker.Sparql.Query : Object {
parse_prologue ();
}
- public DBResultSet? execute () throws DBInterfaceError, SparqlError, DateError {
+ public DBResultSet? execute () throws DBInterfaceError, Sparql.Error, DateError {
prepare_execute ();
@@ -418,7 +409,7 @@ public class Tracker.Sparql.Query : Object {
}
- public DBCursor? execute_cursor () throws DBInterfaceError, SparqlError, DateError {
+ public DBCursor? execute_cursor () throws DBInterfaceError, Sparql.Error, DateError {
prepare_execute ();
@@ -440,7 +431,7 @@ public class Tracker.Sparql.Query : Object {
}
}
- public PtrArray? execute_update (bool blank) throws DataError, DBInterfaceError, SparqlError, DateError {
+ public PtrArray? execute_update (bool blank) throws DataError, DBInterfaceError, Sparql.Error, DateError {
assert (update_extensions);
scanner = new SparqlScanner ((char*) query_string, (long) query_string.size ());
@@ -492,7 +483,7 @@ public class Tracker.Sparql.Query : Object {
return blank_nodes;
}
- DBStatement prepare_for_exec (string sql) throws DBInterfaceError, SparqlError, DateError {
+ DBStatement prepare_for_exec (string sql) throws DBInterfaceError, Sparql.Error, DateError {
var iface = DBManager.get_db_interface ();
var stmt = iface.create_statement ("%s", sql);
@@ -505,7 +496,7 @@ public class Tracker.Sparql.Query : Object {
} else if (binding.literal == "false" || binding.literal == "0") {
stmt.bind_int (i, 0);
} else {
- throw new SparqlError.TYPE ("`%s' is not a valid boolean".printf (binding.literal));
+ throw new Sparql.Error.TYPE ("`%s' is not a valid boolean".printf (binding.literal));
}
} else if (binding.data_type == PropertyType.DATETIME) {
stmt.bind_int (i, string_to_date (binding.literal, null));
@@ -520,19 +511,19 @@ public class Tracker.Sparql.Query : Object {
return stmt;
}
- DBResultSet? exec_sql (string sql) throws DBInterfaceError, SparqlError, DateError {
+ DBResultSet? exec_sql (string sql) throws DBInterfaceError, Sparql.Error, DateError {
var stmt = prepare_for_exec (sql);
return stmt.execute ();
}
- DBCursor? exec_sql_cursor (string sql) throws DBInterfaceError, SparqlError, DateError {
+ DBCursor? exec_sql_cursor (string sql) throws DBInterfaceError, Sparql.Error, DateError {
var stmt = prepare_for_exec (sql);
return stmt.start_cursor ();
}
- string get_select_query () throws DBInterfaceError, SparqlError, DateError {
+ string get_select_query () throws DBInterfaceError, Sparql.Error, DateError {
// SELECT query
// build SQL
@@ -544,15 +535,15 @@ public class Tracker.Sparql.Query : Object {
return sql.str;
}
- DBResultSet? execute_select () throws DBInterfaceError, SparqlError, DateError {
+ DBResultSet? execute_select () throws DBInterfaceError, Sparql.Error, DateError {
return exec_sql (get_select_query ());
}
- DBCursor? execute_select_cursor () throws DBInterfaceError, SparqlError, DateError {
+ DBCursor? execute_select_cursor () throws DBInterfaceError, Sparql.Error, DateError {
return exec_sql_cursor (get_select_query ());
}
- string get_ask_query () throws DBInterfaceError, SparqlError, DateError {
+ string get_ask_query () throws DBInterfaceError, Sparql.Error, DateError {
// ASK query
var pattern_sql = new StringBuilder ();
@@ -579,15 +570,15 @@ public class Tracker.Sparql.Query : Object {
return sql.str;
}
- DBResultSet? execute_ask () throws DBInterfaceError, SparqlError, DateError {
+ DBResultSet? execute_ask () throws DBInterfaceError, Sparql.Error, DateError {
return exec_sql (get_ask_query ());
}
- DBCursor? execute_ask_cursor () throws DBInterfaceError, SparqlError, DateError {
+ DBCursor? execute_ask_cursor () throws DBInterfaceError, Sparql.Error, DateError {
return exec_sql_cursor (get_ask_query ());
}
- private void parse_from_or_into_param () throws SparqlError {
+ private void parse_from_or_into_param () throws Sparql.Error {
if (accept (SparqlTokenType.IRI_REF)) {
current_graph = get_last_string (1);
} else if (accept (SparqlTokenType.PN_PREFIX)) {
@@ -600,7 +591,7 @@ public class Tracker.Sparql.Query : Object {
}
}
- PtrArray? execute_insert_or_delete (bool blank) throws DBInterfaceError, DataError, SparqlError, DateError {
+ PtrArray? execute_insert_or_delete (bool blank) throws DBInterfaceError, DataError, Sparql.Error, DateError {
// INSERT or DELETE
if (accept (SparqlTokenType.WITH)) {
@@ -732,7 +723,7 @@ public class Tracker.Sparql.Query : Object {
return update_blank_nodes;
}
- void execute_drop_graph () throws DBInterfaceError, DataError, SparqlError {
+ void execute_drop_graph () throws DBInterfaceError, DataError, Sparql.Error {
expect (SparqlTokenType.DROP);
expect (SparqlTokenType.GRAPH);
@@ -745,7 +736,7 @@ public class Tracker.Sparql.Query : Object {
Data.update_buffer_flush ();
}
- internal string resolve_prefixed_name (string prefix, string local_name) throws SparqlError {
+ internal string resolve_prefixed_name (string prefix, string local_name) throws Sparql.Error {
string ns = prefix_map.lookup (prefix);
if (ns == null) {
throw get_error ("use of undefined prefix `%s'".printf (prefix));
@@ -753,7 +744,7 @@ public class Tracker.Sparql.Query : Object {
return ns + local_name;
}
- void skip_braces () throws SparqlError {
+ void skip_braces () throws Sparql.Error {
expect (SparqlTokenType.OPEN_BRACE);
int n_braces = 1;
while (n_braces > 0) {
@@ -770,7 +761,7 @@ public class Tracker.Sparql.Query : Object {
}
}
- void parse_construct_triples_block (HashTable<string,string> var_value_map) throws SparqlError, DataError, DateError {
+ void parse_construct_triples_block (HashTable<string,string> var_value_map) throws Sparql.Error, DataError, DateError {
expect (SparqlTokenType.OPEN_BRACE);
while (current () != SparqlTokenType.CLOSE_BRACE) {
@@ -807,7 +798,7 @@ public class Tracker.Sparql.Query : Object {
bool anon_blank_node_open = false;
- string parse_construct_var_or_term (HashTable<string,string> var_value_map) throws SparqlError, DataError, DateError {
+ string parse_construct_var_or_term (HashTable<string,string> var_value_map) throws Sparql.Error, DataError, DateError {
string result = "";
if (current () == SparqlTokenType.VAR) {
next ();
@@ -892,7 +883,7 @@ public class Tracker.Sparql.Query : Object {
return result;
}
- void parse_construct_property_list_not_empty (HashTable<string,string> var_value_map) throws SparqlError, DataError, DateError {
+ void parse_construct_property_list_not_empty (HashTable<string,string> var_value_map) throws Sparql.Error, DataError, DateError {
while (true) {
var old_predicate = current_predicate;
@@ -929,7 +920,7 @@ public class Tracker.Sparql.Query : Object {
}
}
- void parse_construct_object_list (HashTable<string,string> var_value_map) throws SparqlError, DataError, DateError {
+ void parse_construct_object_list (HashTable<string,string> var_value_map) throws Sparql.Error, DataError, DateError {
while (true) {
parse_construct_object (var_value_map);
if (accept (SparqlTokenType.COMMA)) {
@@ -939,7 +930,7 @@ public class Tracker.Sparql.Query : Object {
}
}
- void parse_construct_object (HashTable<string,string> var_value_map) throws SparqlError, DataError, DateError {
+ void parse_construct_object (HashTable<string,string> var_value_map) throws Sparql.Error, DataError, DateError {
string object = parse_construct_var_or_term (var_value_map);
try {
if (delete_statements) {
diff --git a/src/libtracker-data/tracker-sparql-scanner.vala b/src/libtracker-data/tracker-sparql-scanner.vala
index a42c60e..83c5822 100644
--- a/src/libtracker-data/tracker-sparql-scanner.vala
+++ b/src/libtracker-data/tracker-sparql-scanner.vala
@@ -418,7 +418,7 @@ public class Tracker.SparqlScanner : Object {
return (c.isalnum () || c == '_');
}
- public SparqlTokenType read_token (out SourceLocation token_begin, out SourceLocation token_end) throws SparqlError {
+ public SparqlTokenType read_token (out SourceLocation token_begin, out SourceLocation token_end) throws Sparql.Error {
space ();
SparqlTokenType type;
@@ -639,14 +639,14 @@ public class Tracker.SparqlScanner : Object {
current += u.to_utf8 (null);
token_length_in_chars++;
} else {
- throw new SparqlError.PARSE ("%d.%d: invalid UTF-8 character", line, column + token_length_in_chars);
+ throw new Sparql.Error.PARSE ("%d.%d: invalid UTF-8 character", line, column + token_length_in_chars);
}
}
}
if (current[0] == begin[0] && current[1] == begin[0] && current[2] == begin[0]) {
current += 3;
} else {
- throw new SparqlError.PARSE ("%d.%d: syntax error, expected \"\"\"", line, column + token_length_in_chars);
+ throw new Sparql.Error.PARSE ("%d.%d: syntax error, expected \"\"\"", line, column + token_length_in_chars);
}
break;
}
@@ -680,7 +680,7 @@ public class Tracker.SparqlScanner : Object {
token_length_in_chars++;
break;
default:
- throw new SparqlError.PARSE ("%d.%d: invalid escape sequence", line, column + token_length_in_chars);
+ throw new Sparql.Error.PARSE ("%d.%d: invalid escape sequence", line, column + token_length_in_chars);
}
} else if (current[0] == '\n') {
break;
@@ -691,14 +691,14 @@ public class Tracker.SparqlScanner : Object {
token_length_in_chars++;
} else {
current++;
- throw new SparqlError.PARSE ("%d.%d: invalid UTF-8 character", line, column + token_length_in_chars);
+ throw new Sparql.Error.PARSE ("%d.%d: invalid UTF-8 character", line, column + token_length_in_chars);
}
}
}
if (current < end && current[0] != '\n') {
current++;
} else {
- throw new SparqlError.PARSE ("%d.%d: syntax error, expected %c", line, column + token_length_in_chars, begin[0]);
+ throw new Sparql.Error.PARSE ("%d.%d: syntax error, expected %c", line, column + token_length_in_chars, begin[0]);
}
break;
case '^':
@@ -707,7 +707,7 @@ public class Tracker.SparqlScanner : Object {
type = SparqlTokenType.DOUBLE_CIRCUMFLEX;
current += 2;
} else {
- throw new SparqlError.PARSE ("%d.%d: syntax error, unexpected character", line, column);
+ throw new Sparql.Error.PARSE ("%d.%d: syntax error, unexpected character", line, column);
}
break;
case '_':
@@ -717,9 +717,9 @@ public class Tracker.SparqlScanner : Object {
default:
unichar u = ((string) current).get_char_validated ((long) (end - current));
if (u != (unichar) (-1)) {
- throw new SparqlError.PARSE ("%d.%d: syntax error, unexpected character", line, column);
+ throw new Sparql.Error.PARSE ("%d.%d: syntax error, unexpected character", line, column);
} else {
- throw new SparqlError.PARSE ("%d.%d: invalid UTF-8 character", line, column);
+ throw new Sparql.Error.PARSE ("%d.%d: invalid UTF-8 character", line, column);
}
}
}
diff --git a/src/libtracker-data/tracker-turtle-reader.vala b/src/libtracker-data/tracker-turtle-reader.vala
index 2ab09e5..778a746 100644
--- a/src/libtracker-data/tracker-turtle-reader.vala
+++ b/src/libtracker-data/tracker-turtle-reader.vala
@@ -94,7 +94,7 @@ public class Tracker.TurtleReader : Object {
}
}
- inline bool next_token () throws SparqlError {
+ inline bool next_token () throws Sparql.Error {
index = (index + 1) % BUFFER_SIZE;
size--;
if (size <= 0) {
@@ -112,7 +112,7 @@ public class Tracker.TurtleReader : Object {
return tokens[index].type;
}
- inline bool accept (SparqlTokenType type) throws SparqlError {
+ inline bool accept (SparqlTokenType type) throws Sparql.Error {
if (current () == type) {
next_token ();
return true;
@@ -120,11 +120,11 @@ public class Tracker.TurtleReader : Object {
return false;
}
- SparqlError get_error (string msg) {
- return new SparqlError.PARSE ("%d.%d: syntax error, %s".printf (tokens[index].begin.line, tokens[index].begin.column, msg));
+ Sparql.Error get_error (string msg) {
+ return new Sparql.Error.PARSE ("%d.%d: syntax error, %s".printf (tokens[index].begin.line, tokens[index].begin.column, msg));
}
- bool expect (SparqlTokenType type) throws SparqlError {
+ bool expect (SparqlTokenType type) throws Sparql.Error {
if (accept (type)) {
return true;
}
@@ -137,7 +137,7 @@ public class Tracker.TurtleReader : Object {
return ((string) (tokens[last_index].begin.pos + strip)).ndup ((tokens[last_index].end.pos - tokens[last_index].begin.pos - 2 * strip));
}
- string resolve_prefixed_name (string prefix, string local_name) throws SparqlError {
+ string resolve_prefixed_name (string prefix, string local_name) throws Sparql.Error {
string ns = prefix_map.lookup (prefix);
if (ns == null) {
throw get_error ("use of undefined prefix `%s'".printf (prefix));
@@ -145,7 +145,7 @@ public class Tracker.TurtleReader : Object {
return ns + local_name;
}
- public bool next () throws SparqlError {
+ public bool next () throws Sparql.Error {
while (true) {
switch (state) {
case State.INITIAL:
@@ -365,7 +365,7 @@ public class Tracker.TurtleReader : Object {
}
}
- public static void load (string path) throws FileError, SparqlError, DataError, DateError, DBInterfaceError {
+ public static void load (string path) throws FileError, Sparql.Error, DataError, DateError, DBInterfaceError {
try {
Data.begin_transaction ();
diff --git a/src/libtracker-direct/tracker-direct.vala b/src/libtracker-direct/tracker-direct.vala
index 2044902..32953ae 100644
--- a/src/libtracker-direct/tracker-direct.vala
+++ b/src/libtracker-direct/tracker-direct.vala
@@ -33,14 +33,20 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
initialized = false;
}
- public override Sparql.Cursor? query (string sparql, Cancellable? cancellable) throws GLib.Error {
- var query_object = new Sparql.Query (sparql);
- var cursor = query_object.execute_cursor ();
- cursor.connection = this;
- return cursor;
+ public override Sparql.Cursor? query (string sparql, Cancellable? cancellable) throws Sparql.Error {
+ try {
+ var query_object = new Sparql.Query (sparql);
+ var cursor = query_object.execute_cursor ();
+ cursor.connection = this;
+ return cursor;
+ } catch (DBInterfaceError e) {
+ throw new Sparql.Error.INTERNAL (e.message);
+ } catch (DateError e) {
+ throw new Sparql.Error.PARSE (e.message);
+ }
}
- public async override Sparql.Cursor? query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error {
+ public async override Sparql.Cursor? query_async (string sparql, Cancellable? cancellable = null) throws Sparql.Error {
// just creating the cursor won't block
return query (sparql, cancellable);
}
diff --git a/src/libtracker-sparql/tracker-connection.vala b/src/libtracker-sparql/tracker-connection.vala
index d875d8a..c47022e 100644
--- a/src/libtracker-sparql/tracker-connection.vala
+++ b/src/libtracker-sparql/tracker-connection.vala
@@ -26,12 +26,21 @@ public const string TRACKER_DBUS_OBJECT_STATISTICS = "/org/freedesktop/Tracker1/
public const string TRACKER_DBUS_INTERFACE_STEROIDS = TRACKER_DBUS_SERVICE + ".Steroids";
public const string TRACKER_DBUS_OBJECT_STEROIDS = "/org/freedesktop/Tracker1/Steroids";
+public errordomain Tracker.Sparql.Error {
+ PARSE,
+ UNKNOWN_CLASS,
+ UNKNOWN_PROPERTY,
+ TYPE,
+ INTERNAL,
+ UNSUPPORTED
+}
+
public abstract class Tracker.Sparql.Connection : Object {
static bool direct_only;
static weak Connection? singleton;
static int verbosity = 0;
- public static Connection get () throws GLib.Error {
+ public static Connection get () throws Sparql.Error {
if (singleton != null) {
assert (!direct_only);
return singleton;
@@ -45,7 +54,7 @@ public abstract class Tracker.Sparql.Connection : Object {
}
}
- public static Connection get_direct () throws GLib.Error {
+ public static Connection get_direct () throws Sparql.Error {
if (singleton != null) {
assert (direct_only);
return singleton;
@@ -123,41 +132,41 @@ public abstract class Tracker.Sparql.Connection : Object {
}
// Query
- public abstract Cursor? query (string sparql, Cancellable? cancellable = null) throws GLib.Error;
- public async abstract Cursor? query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error;
+ public abstract Cursor? query (string sparql, Cancellable? cancellable = null) throws Sparql.Error;
+ public async abstract Cursor? query_async (string sparql, Cancellable? cancellable = null) throws Sparql.Error;
// Update
- public virtual void update (string sparql, Cancellable? cancellable = null) throws GLib.Error {
+ public virtual void update (string sparql, Cancellable? cancellable = null) throws Sparql.Error {
warning ("Interface 'update' not implemented");
}
- public async virtual void update_async (string sparql, int? priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws GLib.Error {
+ public async virtual void update_async (string sparql, int? priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error {
warning ("Interface 'update_async' not implemented");
}
// Only applies to update_async with the right priority.
// Priority is used to identify batch updates.
- public virtual void update_commit (Cancellable? cancellable = null) throws GLib.Error {
+ public virtual void update_commit (Cancellable? cancellable = null) throws Sparql.Error {
warning ("Interface 'update_commit' not implemented");
}
- public async virtual void update_commit_async (Cancellable? cancellable = null) throws GLib.Error {
+ public async virtual void update_commit_async (Cancellable? cancellable = null) throws Sparql.Error {
warning ("Interface 'update_commit_async' not implemented");
}
// Import
- public virtual void import (File file, Cancellable? cancellable = null) throws GLib.Error {
+ public virtual void import (File file, Cancellable? cancellable = null) throws Sparql.Error {
warning ("Interface 'import' not implemented");
}
- public async virtual void import_async (File file, Cancellable? cancellable = null) throws GLib.Error {
+ public async virtual void import_async (File file, Cancellable? cancellable = null) throws Sparql.Error {
warning ("Interface 'import_async' not implemented");
}
// Statistics
- public virtual Cursor? statistics (Cancellable? cancellable = null) throws GLib.Error {
+ public virtual Cursor? statistics (Cancellable? cancellable = null) throws Sparql.Error {
warning ("Interface 'statistics' not implemented");
return null;
}
- public async virtual Cursor? statistics_async (Cancellable? cancellable = null) throws GLib.Error {
+ public async virtual Cursor? statistics_async (Cancellable? cancellable = null) throws Sparql.Error {
warning ("Interface 'statistics_async' not implemented");
return null;
}
diff --git a/src/libtracker-sparql/tracker-plugin-loader.vala b/src/libtracker-sparql/tracker-plugin-loader.vala
index 703b8f2..d000e26 100644
--- a/src/libtracker-sparql/tracker-plugin-loader.vala
+++ b/src/libtracker-sparql/tracker-plugin-loader.vala
@@ -24,18 +24,22 @@ class Tracker.Sparql.PluginLoader : Connection {
private delegate Tracker.Sparql.Connection ModuleInitFunc ();
- public PluginLoader (bool direct_only = false) throws Error
+ public PluginLoader (bool direct_only = false) throws Sparql.Error
requires (!initialized) {
if (!Module.supported ()) {
return;
}
- load_plugins (direct_only);
+ try {
+ load_plugins (direct_only);
+ } catch (GLib.Error e) {
+ throw new Sparql.Error.INTERNAL (e.message);
+ }
initialized = true;
}
- public override Cursor? query (string sparql, Cancellable? cancellable = null) throws GLib.Error {
+ public override Cursor? query (string sparql, Cancellable? cancellable = null) throws Sparql.Error {
if (direct != null) {
return direct.query (sparql, cancellable);
} else {
@@ -43,7 +47,7 @@ class Tracker.Sparql.PluginLoader : Connection {
}
}
- public async override Cursor? query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error {
+ public async override Cursor? query_async (string sparql, Cancellable? cancellable = null) throws Sparql.Error {
if (direct != null) {
return yield direct.query_async (sparql, cancellable);
} else {
@@ -51,35 +55,35 @@ class Tracker.Sparql.PluginLoader : Connection {
}
}
- public override void update (string sparql, Cancellable? cancellable = null) throws GLib.Error {
+ public override void update (string sparql, Cancellable? cancellable = null) throws Sparql.Error {
bus.update (sparql, cancellable);
}
- public async override void update_async (string sparql, int? priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws GLib.Error {
+ public async override void update_async (string sparql, int? priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error {
yield bus.update_async (sparql, priority, cancellable);
}
- public override void update_commit (Cancellable? cancellable = null) throws GLib.Error {
+ public override void update_commit (Cancellable? cancellable = null) throws Sparql.Error {
bus.update_commit (cancellable);
}
- public async override void update_commit_async (Cancellable? cancellable = null) throws GLib.Error {
+ public async override void update_commit_async (Cancellable? cancellable = null) throws Sparql.Error {
yield bus.update_commit_async (cancellable);
}
- public override void import (File file, Cancellable? cancellable = null) throws GLib.Error {
+ public override void import (File file, Cancellable? cancellable = null) throws Sparql.Error {
bus.import (file, cancellable);
}
- public async override void import_async (File file, Cancellable? cancellable = null) throws GLib.Error {
+ public async override void import_async (File file, Cancellable? cancellable = null) throws Sparql.Error {
yield bus.import_async (file, cancellable);
}
- public override Cursor? statistics (Cancellable? cancellable = null) throws GLib.Error {
+ public override Cursor? statistics (Cancellable? cancellable = null) throws Sparql.Error {
return bus.statistics (cancellable);
}
- public async override Cursor? statistics_async (Cancellable? cancellable = null) throws GLib.Error {
+ public async override Cursor? statistics_async (Cancellable? cancellable = null) throws Sparql.Error {
return yield bus.statistics_async (cancellable);
}
diff --git a/src/tracker-store/Makefile.am b/src/tracker-store/Makefile.am
index e1330e4..d3037d8 100644
--- a/src/tracker-store/Makefile.am
+++ b/src/tracker-store/Makefile.am
@@ -9,6 +9,7 @@ INCLUDES = \
-DTRACKER_COMPILATION \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
+ -I$(top_builddir)/src/libtracker-sparql \
-I$(top_builddir)/src/libtracker-data \
$(WARN_CFLAGS) \
$(GLIB2_CFLAGS) \
diff --git a/tests/libtracker-data/Makefile.am b/tests/libtracker-data/Makefile.am
index 653446c..52b4545 100644
--- a/tests/libtracker-data/Makefile.am
+++ b/tests/libtracker-data/Makefile.am
@@ -60,6 +60,7 @@ INCLUDES = \
-I$(top_srcdir)/tests/common \
-I$(top_builddir)/src \
-I$(top_builddir)/src/libtracker-client \
+ -I$(top_srcdir)/src/libtracker-sparql \
$(WARN_CFLAGS) \
$(GCOV_CFLAGS) \
$(DBUS_CFLAGS) \
diff --git a/tests/libtracker-fts/Makefile.am b/tests/libtracker-fts/Makefile.am
index e61147f..edf21aa 100644
--- a/tests/libtracker-fts/Makefile.am
+++ b/tests/libtracker-fts/Makefile.am
@@ -22,6 +22,7 @@ INCLUDES = \
-I$(top_srcdir)/tests/common \
-I$(top_builddir)/src \
-I$(top_builddir)/src/libtracker-client \
+ -I$(top_srcdir)/src/libtracker-sparql \
$(WARN_CFLAGS) \
$(GCOV_CFLAGS) \
$(DBUS_CFLAGS) \
diff --git a/utils/services/Makefile.am b/utils/services/Makefile.am
index e8db519..28b3b89 100644
--- a/utils/services/Makefile.am
+++ b/utils/services/Makefile.am
@@ -9,6 +9,7 @@ INCLUDES = \
-DTRACKER_COMPILATION \
-DTOP_SRCDIR=\"$(top_srcdir)\" \
-I$(top_srcdir)/src \
+ -I$(top_srcdir)/src/libtracker-sparql \
-I$(top_builddir)/src \
$(WARN_CFLAGS) \
$(GLIB2_CFLAGS) \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]