[tracker/parser] SPARQL: Code cleanup
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/parser] SPARQL: Code cleanup
- Date: Tue, 11 Aug 2009 16:12:16 +0000 (UTC)
commit 11f665e4b8cb9c8833bd351082f52b99bc14deb0
Author: Jürg Billeter <j bitron ch>
Date: Tue Aug 11 16:51:38 2009 +0200
SPARQL: Code cleanup
src/libtracker-data/tracker-sparql-query.vala | 32 +++++++++++--------------
1 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index 3220e5e..1241add 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -621,15 +621,7 @@ public class Tracker.SparqlQuery : Object {
} else {
sql.append (", ");
}
- if (accept (SparqlTokenType.ASC)) {
- translate_bracketted_expression_as_string (sql);
- sql.append (" ASC");
- } else if (accept (SparqlTokenType.DESC)) {
- translate_bracketted_expression_as_string (sql);
- sql.append (" DESC");
- } else {
- translate_primary_expression_as_string (sql);
- }
+ translate_order_condition (sql);
} while (current () != SparqlTokenType.ORDER && current () != SparqlTokenType.LIMIT && current () != SparqlTokenType.OFFSET && current () != SparqlTokenType.EOF);
}
@@ -643,15 +635,7 @@ public class Tracker.SparqlQuery : Object {
} else {
sql.append (", ");
}
- if (accept (SparqlTokenType.ASC)) {
- translate_bracketted_expression_as_string (sql);
- sql.append (" ASC");
- } else if (accept (SparqlTokenType.DESC)) {
- translate_bracketted_expression_as_string (sql);
- sql.append (" DESC");
- } else {
- translate_primary_expression_as_string (sql);
- }
+ translate_order_condition (sql);
} while (current () != SparqlTokenType.LIMIT && current () != SparqlTokenType.OFFSET && current () != SparqlTokenType.EOF);
}
@@ -703,6 +687,18 @@ public class Tracker.SparqlQuery : Object {
return exec_sql (sql.str);
}
+ void translate_order_condition (StringBuilder sql) throws SparqlError {
+ if (accept (SparqlTokenType.ASC)) {
+ translate_bracketted_expression_as_string (sql);
+ sql.append (" ASC");
+ } else if (accept (SparqlTokenType.DESC)) {
+ translate_bracketted_expression_as_string (sql);
+ sql.append (" DESC");
+ } else {
+ translate_primary_expression_as_string (sql);
+ }
+ }
+
DBResultSet? execute_ask () throws Error {
// ASK query
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]