1
0
Fork 0

Added an option to serialize Variables in TraverserOptions.

This commit is contained in:
Michael Hackstein 2016-10-10 14:38:55 +02:00
parent 02f854beeb
commit 64e4ee636d
5 changed files with 24 additions and 1 deletions

View File

@ -61,3 +61,14 @@ void FixedVarExpressionContext::setVariableValue(Variable const* var,
AqlValue value) {
_vars.emplace(var, value);
}
void FixedVarExpressionContext::serializeAllVariables(
arangodb::Transaction* trx, VPackBuilder& builder) const {
TRI_ASSERT(builder.isOpenArray());
for (auto const& it : _vars) {
builder.openArray();
it.first->toVelocyPack(builder);
it.second.toVelocyPack(trx, builder, true);
builder.close();
}
}

View File

@ -50,6 +50,9 @@ class FixedVarExpressionContext : public ExpressionContext {
void setVariableValue(Variable const*, AqlValue);
void serializeAllVariables(arangodb::Transaction*,
arangodb::velocypack::Builder&) const;
private:
/// @brief temporary storage for expression data context
std::unordered_map<Variable const*, AqlValue> _vars;

View File

@ -294,6 +294,8 @@ void TraversalBlock::initializePaths(AqlItemBlock const* items, size_t pos) {
return;
}
initializeExpressions(items, pos);
if (!_useRegister) {
if (!_usedConstant) {
_usedConstant = true;
@ -326,7 +328,6 @@ void TraversalBlock::initializePaths(AqlItemBlock const* items, size_t pos) {
"allowed");
}
}
initializeExpressions(items, pos);
// cppcheck-suppress style
DEBUG_END_BLOCK();

View File

@ -649,3 +649,9 @@ void arangodb::traverser::TraverserOptions::linkTraverser(
_traverser = trav;
}
void arangodb::traverser::TraverserOptions::serializeVariables(
VPackBuilder& builder) const {
TRI_ASSERT(builder.isOpenArray());
_ctx->serializeAllVariables(_trx, builder);
}

View File

@ -161,6 +161,8 @@ struct TraverserOptions {
void linkTraverser(arangodb::traverser::ClusterTraverser*);
void serializeVariables(arangodb::velocypack::Builder&) const;
private:
EdgeCursor* nextCursorLocal(arangodb::velocypack::Slice, size_t,
std::vector<LookupInfo>&) const;