mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
c267ef9ab5
|
@ -354,6 +354,7 @@ void Expression::analyzeExpression () {
|
||||||
// specialize the simple expression into an attribute accessor
|
// specialize the simple expression into an attribute accessor
|
||||||
_accessor = new AttributeAccessor(name, v);
|
_accessor = new AttributeAccessor(name, v);
|
||||||
_type = ATTRIBUTE;
|
_type = ATTRIBUTE;
|
||||||
|
_built = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -808,8 +809,13 @@ bool Expression::isConstant () const {
|
||||||
/// call isAttributeAccess in advance to ensure no exceptions.
|
/// call isAttributeAccess in advance to ensure no exceptions.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
std::pair<std::string, std::string> Expression::getMultipleAttributes() {
|
std::pair<std::string, std::string> Expression::getAttributeAccess () {
|
||||||
if (_type != SIMPLE && _type != ATTRIBUTE) {
|
if (_type == UNPROCESSED) {
|
||||||
|
analyzeExpression();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_type != SIMPLE &&
|
||||||
|
_type != ATTRIBUTE) {
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
||||||
"getMultipleAttributes works only on simple expressions or attribute accesses!");
|
"getMultipleAttributes works only on simple expressions or attribute accesses!");
|
||||||
}
|
}
|
||||||
|
@ -819,11 +825,11 @@ std::pair<std::string, std::string> Expression::getMultipleAttributes() {
|
||||||
|
|
||||||
if (expNode->type != triagens::aql::NODE_TYPE_ATTRIBUTE_ACCESS) {
|
if (expNode->type != triagens::aql::NODE_TYPE_ATTRIBUTE_ACCESS) {
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
||||||
"getAccessNRef works only on simple expressions!");
|
"getMultipleAttributes works only on simple expressions or attribute accesses(2)!");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (expNode->type == triagens::aql::NODE_TYPE_ATTRIBUTE_ACCESS) {
|
while (expNode->type == triagens::aql::NODE_TYPE_ATTRIBUTE_ACCESS) {
|
||||||
attributeVector.push_back(expNode->getStringValue());
|
attributeVector.emplace_back(expNode->getStringValue());
|
||||||
expNode = expNode->getMember(0);
|
expNode = expNode->getMember(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,14 +838,14 @@ std::pair<std::string, std::string> Expression::getMultipleAttributes() {
|
||||||
oneAttr != attributeVector.rend();
|
oneAttr != attributeVector.rend();
|
||||||
++oneAttr) {
|
++oneAttr) {
|
||||||
if (! attributeVectorStr.empty()) {
|
if (! attributeVectorStr.empty()) {
|
||||||
attributeVectorStr += std::string(".");
|
attributeVectorStr.push_back('.');
|
||||||
}
|
}
|
||||||
attributeVectorStr += *oneAttr;
|
attributeVectorStr += *oneAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expNode->type != triagens::aql::NODE_TYPE_REFERENCE) {
|
if (expNode->type != triagens::aql::NODE_TYPE_REFERENCE) {
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
||||||
"getAccessNRef works only on simple expressions!");
|
"getMultipleAttributes works only on simple expressions or attribute accesses(3)!");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto variable = static_cast<Variable*>(expNode->getData());
|
auto variable = static_cast<Variable*>(expNode->getData());
|
||||||
|
|
|
@ -243,7 +243,7 @@ namespace triagens {
|
||||||
/// call isAttributeAccess in advance to ensure no exceptions.
|
/// call isAttributeAccess in advance to ensure no exceptions.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
std::pair<std::string, std::string> getMultipleAttributes();
|
std::pair<std::string, std::string> getAttributeAccess();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief stringify an expression
|
/// @brief stringify an expression
|
||||||
|
|
|
@ -2590,7 +2590,7 @@ public:
|
||||||
auto oneSortExpression = cn->expression();
|
auto oneSortExpression = cn->expression();
|
||||||
|
|
||||||
if (oneSortExpression->isAttributeAccess()) {
|
if (oneSortExpression->isAttributeAccess()) {
|
||||||
auto simpleExpression = oneSortExpression->getMultipleAttributes();
|
auto simpleExpression = oneSortExpression->getAttributeAccess();
|
||||||
d->variableName = simpleExpression.first;
|
d->variableName = simpleExpression.first;
|
||||||
d->attributevec = simpleExpression.second;
|
d->attributevec = simpleExpression.second;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue