mirror of https://gitee.com/bigwinds/arangodb
parent
fd9a67e3cc
commit
762c0fd7c6
|
@ -1,3 +1,9 @@
|
|||
v3.4.2 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
||||
* fixed issue #7834: AQL Query crashes instance
|
||||
|
||||
|
||||
v3.4.1 (2018-12-19)
|
||||
-------------------
|
||||
|
||||
|
|
|
@ -191,19 +191,8 @@ void Scopes::addVariable(Variable* variable) {
|
|||
void Scopes::replaceVariable(Variable* variable) {
|
||||
TRI_ASSERT(!_activeScopes.empty());
|
||||
TRI_ASSERT(variable != nullptr);
|
||||
|
||||
for (auto it = _activeScopes.rbegin(); it != _activeScopes.rend(); ++it) {
|
||||
auto scope = (*it);
|
||||
|
||||
if (scope->existsVariable(variable->name)) {
|
||||
// replace existing variable
|
||||
scope->addVariable(variable);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
||||
"unable to find AQL variable in scopes");
|
||||
|
||||
_activeScopes.back()->addVariable(variable);
|
||||
}
|
||||
|
||||
/// @brief checks whether a variable exists in any scope
|
||||
|
|
|
@ -155,6 +155,15 @@ function ahuacatlModifySuite () {
|
|||
c1 = null;
|
||||
c2 = null;
|
||||
},
|
||||
|
||||
testVariableScope : function () {
|
||||
let query = "INSERT {value: 1} INTO " + cn1 + " LET id1 = (UPDATE 'foo' WITH {value: 2} IN " + cn2 + ") RETURN NEW";
|
||||
let result = AQL_EXECUTE(query).json;
|
||||
assertEqual(1, result[0].value);
|
||||
assertEqual(2, c1.count());
|
||||
assertEqual(1, c2.count());
|
||||
assertEqual(2, c2.document("foo").value);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test subquery
|
||||
|
|
Loading…
Reference in New Issue