Fix assignment of  and  variables for subqueries
@@ -166,7 +166,11 @@ public class OBasicCommandContext implements OCommandContext {
if (variables.containsKey(iName)) {
variables.put(iName, iValue);//this is a local existing variable, so it's bound to current contex
} else if (parent != null && parent instanceof OBasicCommandContext && ((OBasicCommandContext) parent).hasVariable(iName)) {
+ if ("current".equalsIgnoreCase(iName) || "parent".equalsIgnoreCase(iName)) {
+ variables.put(iName, iValue);
+ } else {
parent.setVariable(iName, iValue);// it is an existing variable in parent context, so it's bound to parent context
+ }
} else {
variables.put(iName, iValue); //it's a new variable, so it's created in this context
}
@@ -184,7 +188,8 @@ public class OBasicCommandContext implements OCommandContext {
return false;
}
- @Override public OCommandContext incrementVariable(String iName) {
+ @Override
+ public OCommandContext incrementVariable(String iName) {
if (iName != null) {
if (iName.startsWith("$"))
iName = iName.substring(1);
@@ -278,7 +283,8 @@ public class OBasicCommandContext implements OCommandContext {
return this;
}
- @Override public String toString() {
+ @Override
+ public String toString() {
return getVariables().toString();
}
@@ -291,7 +297,8 @@ public class OBasicCommandContext implements OCommandContext {
return this;
}
- @Override public void beginExecution(final long iTimeout, final TIMEOUT_STRATEGY iStrategy) {
+ @Override
+ public void beginExecution(final long iTimeout, final TIMEOUT_STRATEGY iStrategy) {
if (iTimeout > 0) {
executionStartedOn = System.currentTimeMillis();
timeoutMs = iTimeout;
@@ -317,7 +324,8 @@ public class OBasicCommandContext implements OCommandContext {
return true;
}
- @Override public OCommandContext copy() {
+ @Override
+ public OCommandContext copy() {
final OBasicCommandContext copy = new OBasicCommandContext();
copy.init();
@@ -330,7 +338,8 @@ public class OBasicCommandContext implements OCommandContext {
return copy;
}
- @Override public void merge(final OCommandContext iContext) {
+ @Override
+ public void merge(final OCommandContext iContext) {
// TODO: SOME VALUES NEED TO BE MERGED
}
@@ -365,6 +374,7 @@ public class OBasicCommandContext implements OCommandContext {
* adds an item to the unique result set
*
* @param o the result item to add
+ *
* @return true if the element is successfully added (it was not present yet), false otherwise (it was already present)
*/
public synchronized boolean addToUniqueResult(Object o) {
