[tracker/wip/carlosg/unrestricted-predicates: 18/18] libtracker-data: Add quotes around string literal



commit 7bb2bdfb0c33add837db02644a39feb1de19144c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Feb 1 16:09:02 2019 +0100

    libtracker-data: Add quotes around string literal
    
    If the query is not cacheable, we were adding string literals unquoted.
    Oops.

 src/libtracker-data/tracker-sparql.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 5d47c7fb1..f83f70df9 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -465,6 +465,8 @@ _append_literal_sql (TrackerSparql         *sparql,
        if (!sparql->cacheable) {
                gchar *escaped, *full_str;
 
+               _append_string (sparql, "\"");
+
                switch (TRACKER_BINDING (binding)->data_type) {
                case TRACKER_PROPERTY_TYPE_DATE:
                        full_str = g_strdup_printf ("%sT00:00:00Z", binding->literal);
@@ -494,6 +496,8 @@ _append_literal_sql (TrackerSparql         *sparql,
                        _append_string (sparql, binding->literal);
                        break;
                }
+
+               _append_string (sparql, "\"");
        } else {
                _append_string_printf (sparql, "?%d ", idx + 1);
        }


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