[tracker/wip/carlosg/grilo-fixes: 3/9] libtracker-data: Accept statement bindings in limit/offset
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/grilo-fixes: 3/9] libtracker-data: Accept statement bindings in limit/offset
- Date: Tue, 26 May 2020 18:24:20 +0000 (UTC)
commit 87ab73e0d822ee052b25e5dda6ebb6d42cd551f0
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun May 24 12:24:50 2020 +0200
libtracker-data: Accept statement bindings in limit/offset
It just needed a little kick to have those accepted. This makes
queries with limit/offset reusable for the following chunks.
src/libtracker-data/tracker-sparql-grammar.h | 12 ++++++++++--
src/libtracker-data/tracker-sparql.c | 6 ++++--
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-grammar.h b/src/libtracker-data/tracker-sparql-grammar.h
index f8cc8a1bf..5f9fa4a52 100644
--- a/src/libtracker-data/tracker-sparql-grammar.h
+++ b/src/libtracker-data/tracker-sparql-grammar.h
@@ -1358,12 +1358,20 @@ static const TrackerGrammarRule helper_ValuesClause_opt[] = { S(helper_ValuesCla
static const TrackerGrammarRule rule_ValuesClause[] = { OPT(helper_ValuesClause_opt), NIL };
/* OffsetClause ::= 'OFFSET' INTEGER
+ *
+ * TRACKER EXTENSION:
+ * The terminal PARAMETERIZED_VAR is additionally accepted
*/
-static const TrackerGrammarRule rule_OffsetClause[] = { L(OFFSET), T(INTEGER), NIL };
+static const TrackerGrammarRule helper_OffsetClause_or[] = { T(INTEGER), T(PARAMETERIZED_VAR), NIL };
+static const TrackerGrammarRule rule_OffsetClause[] = { L(OFFSET), OR(helper_OffsetClause_or), NIL };
/* LimitClause ::= 'LIMIT' INTEGER
+ *
+ * TRACKER EXTENSION:
+ * The terminal PARAMETERIZED_VAR is additionally accepted
*/
-static const TrackerGrammarRule rule_LimitClause[] = { L(LIMIT), T(INTEGER), NIL };
+static const TrackerGrammarRule helper_LimitClause_or[] = { T(INTEGER), T(PARAMETERIZED_VAR), NIL };
+static const TrackerGrammarRule rule_LimitClause[] = { L(LIMIT), OR(helper_LimitClause_or), NIL };
/* LimitOffsetClauses ::= LimitClause OffsetClause? | OffsetClause LimitClause?
*/
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 8093c85f4..83d57ba6b 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -3374,7 +3374,8 @@ translate_LimitClause (TrackerSparql *sparql,
/* LimitClause ::= 'LIMIT' INTEGER
*/
_expect (sparql, RULE_TYPE_LITERAL, LITERAL_LIMIT);
- _expect (sparql, RULE_TYPE_TERMINAL, TERMINAL_TYPE_INTEGER);
+ if (!_accept (sparql, RULE_TYPE_TERMINAL, TERMINAL_TYPE_PARAMETERIZED_VAR))
+ _expect (sparql, RULE_TYPE_TERMINAL, TERMINAL_TYPE_INTEGER);
sparql->current_state.expression_type = TRACKER_PROPERTY_TYPE_INTEGER;
return TRUE;
@@ -3387,7 +3388,8 @@ translate_OffsetClause (TrackerSparql *sparql,
/* OffsetClause ::= 'OFFSET' INTEGER
*/
_expect (sparql, RULE_TYPE_LITERAL, LITERAL_OFFSET);
- _expect (sparql, RULE_TYPE_TERMINAL, TERMINAL_TYPE_INTEGER);
+ if (!_accept (sparql, RULE_TYPE_TERMINAL, TERMINAL_TYPE_PARAMETERIZED_VAR))
+ _expect (sparql, RULE_TYPE_TERMINAL, TERMINAL_TYPE_INTEGER);
sparql->current_state.expression_type = TRACKER_PROPERTY_TYPE_INTEGER;
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]