[tracker: 5/9] libtracker-data: Relate Variable objects to their origin Context



commit 5c0fe132eb7d0e193ccc669447e015f8f9e8b3d6
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 18 22:01:38 2015 +0200

    libtracker-data: Relate Variable objects to their origin Context
    
    It will be necessary so we can figure out at query construction time
    whether we are in a scope where we can use the variable alias or not.

 src/libtracker-data/tracker-sparql-query.vala |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index 301de7b..e610757 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -83,12 +83,14 @@ namespace Tracker.Sparql {
                public string sql_expression { get; private set; }
                public VariableBinding binding;
                string sql_identifier;
+               public Context origin_context { get; private set; }
 
-               public Variable (string name, int index) {
+               public Variable (string name, int index, Context context) {
                        this.name = name;
                        this.index = index;
                        this.sql_identifier = "%d_u".printf (index);
                        this.sql_expression = "\"%s\"".printf (sql_identifier);
+                       this.origin_context = context;
                }
 
                public string get_extra_sql_expression (string suffix) {
@@ -151,7 +153,7 @@ namespace Tracker.Sparql {
                internal unowned Variable get_variable (string name) {
                        unowned Variable result = this.var_map.lookup (name);
                        if (result == null) {
-                               var variable = new Variable (name, ++query.last_var_index);
+                               var variable = new Variable (name, ++query.last_var_index, this);
                                this.var_map.insert (name, variable);
 
                                result = variable;


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