summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-10-18 22:01:38 +0200
committerCarlos Garnacho <carlosg@gnome.org>2015-10-19 14:06:59 +0200
commit2a5a5558e8a5e1c1c556a30c8134649c00de0cfb (patch)
treee5a53075254a54ab8e11fd22cd88d54a30c6ba12
parentb4257e62282b9e0c760e6e62168ef44579781a7a (diff)
downloadtracker-2a5a5558e8a5e1c1c556a30c8134649c00de0cfb.tar.gz
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.
-rw-r--r--src/libtracker-data/tracker-sparql-query.vala6
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 301de7ba6..e610757c6 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;