[tracker/wip/carlosg/serialize-api: 6/13] libtracker-data: Refactor code
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/serialize-api: 6/13] libtracker-data: Refactor code
- Date: Wed, 2 Feb 2022 13:48:32 +0000 (UTC)
commit 528f7a77a626b83f9f7b4cf32cdc5b1127d5ca24
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jan 30 14:37:47 2022 +0100
libtracker-data: Refactor code
Shuffle handling/setting/usage of TrackerPropertyType when iterating
the selected variables in a SELECT clause. This should have no functional
changes.
src/libtracker-data/tracker-sparql.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 16b7a567f..93c33f40e 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -2896,6 +2896,7 @@ translate_SelectClause (TrackerSparql *sparql,
} else {
do {
TrackerVariable *var;
+ TrackerPropertyType prop_type;
if (_check_in_rule (sparql, NAMED_RULE_Var)) {
gchar *name;
@@ -2913,29 +2914,30 @@ translate_SelectClause (TrackerSparql *sparql,
found = tracker_context_lookup_variable_by_name
(sparql->current_state->context,
name);
var = _last_node_variable (sparql);
+ prop_type = sparql->current_state->expression_type;
if (found) {
_append_string_printf (sparql, "%s ",
tracker_variable_get_sql_expression (var));
if (sparql->current_state->select_context == sparql->context)
- convert_expression_to_string (sparql,
sparql->current_state->expression_type);
+ convert_expression_to_string (sparql, prop_type);
- select_context->type = sparql->current_state->expression_type;
+ select_context->type = prop_type;
} else {
_append_string (sparql, "NULL ");
- select_context->type = TRACKER_PROPERTY_TYPE_UNKNOWN;
+ select_context->type = prop_type = TRACKER_PROPERTY_TYPE_UNKNOWN;
}
if (_accept (sparql, RULE_TYPE_LITERAL, LITERAL_AS)) {
- if (!handle_as (sparql, select_context->type, error)) {
+ if (!handle_as (sparql, prop_type, error)) {
g_free (name);
return FALSE;
}
} else {
_append_string_printf (sparql, "AS \"%s\" ", var->name);
- tracker_sparql_add_select_var (sparql, name, select_context->type);
+ tracker_sparql_add_select_var (sparql, name, prop_type);
}
tracker_sparql_swap_builder (sparql, old);
@@ -2954,20 +2956,21 @@ translate_SelectClause (TrackerSparql *sparql,
str = _append_placeholder (sparql);
old = tracker_sparql_swap_builder (sparql, str);
_call_rule (sparql, NAMED_RULE_Expression, error);
+ prop_type = sparql->current_state->expression_type;
if (sparql->current_state->select_context == sparql->context)
- convert_expression_to_string (sparql,
sparql->current_state->expression_type);
+ convert_expression_to_string (sparql, prop_type);
- select_context->type = sparql->current_state->expression_type;
+ select_context->type = prop_type;
if (_accept (sparql, RULE_TYPE_LITERAL, LITERAL_AS)) {
- if (!handle_as (sparql, sparql->current_state->expression_type,
error))
+ if (!handle_as (sparql, prop_type, error))
return FALSE;
} else if (sparql->current_state->select_context == sparql->context) {
/* This is only allowed on the topmost context, an
* expression without AS in a subselect is meaningless
*/
- tracker_sparql_add_select_var (sparql, "",
sparql->current_state->expression_type);
+ tracker_sparql_add_select_var (sparql, "", prop_type);
}
tracker_sparql_swap_builder (sparql, old);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]