[tracker/wip/carlosg/tracker-3.0-api-breaks: 94/100] libtracker-data: Hint expression type on InlineDataOneVar



commit 6efed2b2e2f251450ac39e644163bf015c3f1fb1
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Feb 5 13:16:14 2020 +0100

    libtracker-data: Hint expression type on InlineDataOneVar
    
    This makes some assumptions (eg. VALUES ?v { ... } having a consistent
    data type in its set), and it's possible that we can't infer the type
    at all (eg. in the case of variables or parameters), but it's more
    likely to result in correct datatypes being returned with the inline
    data, eg:
    
    SELECT ?u DATATYPE(?u) { VALUES ?u { 1 2 4 8 } }

 src/libtracker-data/tracker-sparql.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 559b14d9e..a69f1a66b 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -4822,6 +4822,8 @@ translate_InlineDataOneVar (TrackerSparql  *sparql,
 
        if (n_values == 0)
                _append_string (sparql, "SELECT NULL WHERE FALSE");
+       else
+               tracker_binding_set_data_type (binding, sparql->current_state.expression_type);
 
        _expect (sparql, RULE_TYPE_LITERAL, LITERAL_CLOSE_BRACE);
        _append_string (sparql, ") ");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]