[tracker/wip/carlosg/more-sparql-fixes: 3/5] libtracker-data: Add column to triples table to get raw value




commit 34c3af8ba9cc9f076bf9b45b63541de986c4206e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Mar 26 20:22:16 2022 +0100

    libtracker-data: Add column to triples table to get raw value
    
    This column contains the object value as stored in the actual tables,
    not a string representation.

 src/libtracker-data/tracker-vtab-triples.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-vtab-triples.c b/src/libtracker-data/tracker-vtab-triples.c
index 469a6f02e..6879da38b 100644
--- a/src/libtracker-data/tracker-vtab-triples.c
+++ b/src/libtracker-data/tracker-vtab-triples.c
@@ -44,6 +44,7 @@ enum {
        COL_PREDICATE,
        COL_OBJECT,
        COL_OBJECT_TYPE,
+       COL_OBJECT_RAW,
        N_COLS
 };
 
@@ -158,7 +159,8 @@ triples_connect (sqlite3            *db,
                                   "    subject INTEGER, "
                                   "    predicate INTEGER, "
                                   "    object INTEGER, "
-                                  "    object_type INTEGER"
+                                  "    object_type INTEGER, "
+                                  "    object_raw INTEGER"
                                   ")");
 
        if (rc == SQLITE_OK) {
@@ -200,7 +202,8 @@ triples_best_index (sqlite3_vtab       *vtab,
                 * translation to strings can be done.
                 */
                if (info->aConstraint[i].iColumn == COL_OBJECT ||
-                   info->aConstraint[i].iColumn == COL_OBJECT_TYPE)
+                   info->aConstraint[i].iColumn == COL_OBJECT_TYPE ||
+                   info->aConstraint[i].iColumn == COL_OBJECT_RAW)
                        continue;
 
                if (info->aConstraint[i].iColumn == COL_ROWID) {
@@ -478,13 +481,15 @@ init_stmt (TrackerTriplesCursor *cursor)
                                        "SELECT %" G_GINT64_FORMAT ", t.ID, "
                                        "       (SELECT ID From Resource WHERE Uri = \"%s\"), "
                                        "       %s, "
-                                       "       %d "
+                                       "       %d, "
+                                       "       t.\"%s\" "
                                        "FROM \"%s\".\"%s\" AS t "
                                        "WHERE 1 ",
                                        graph_id,
                                        tracker_property_get_uri (property),
                                        string_expr,
                                        tracker_property_get_data_type (property),
+                                       tracker_property_get_name (property),
                                        graph,
                                        tracker_property_get_table_name (property));
 


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