1
0
Fork 0
This commit is contained in:
Jan 2019-01-02 11:09:06 +01:00 committed by GitHub
parent fd9a67e3cc
commit 762c0fd7c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 13 deletions

View File

@ -1,3 +1,9 @@
v3.4.2 (XXXX-XX-XX)
-------------------
* fixed issue #7834: AQL Query crashes instance
v3.4.1 (2018-12-19)
-------------------

View File

@ -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

View File

@ -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