mirror of https://gitee.com/bigwinds/arangodb
bug in increment and decrement in agency solved.
This commit is contained in:
parent
43749f1f52
commit
19267cbbac
|
@ -209,36 +209,24 @@ bool Node::applies (VPackSlice const& slice) {
|
|||
*this = slice.get("new");
|
||||
return true;
|
||||
} else if (oper == "increment") { // Increment
|
||||
/* if (!(self.isInt() || self.isUInt())) {
|
||||
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||
<< "Element to increment must be integral type: We are "
|
||||
<< self.toJson();
|
||||
return false;
|
||||
}*/
|
||||
Builder tmp;
|
||||
try {
|
||||
Builder tmp;
|
||||
tmp.add(Value(self.isInt() ? int64_t(self.getInt()+1) :
|
||||
uint64_t(self.getUInt()+1)));
|
||||
*this = tmp.slice();
|
||||
} catch (std::exception const& e) {
|
||||
return false;
|
||||
tmp.add(Value(1));
|
||||
}
|
||||
*this = tmp.slice();
|
||||
return true;
|
||||
} else if (oper == "decrement") { // Decrement
|
||||
/* if (!(self.isInt() || self.isUInt())) {
|
||||
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||
<< "Element to decrement must be integral type. We are "
|
||||
<< self.toJson();
|
||||
return false;
|
||||
}*/
|
||||
Builder tmp;
|
||||
try {
|
||||
Builder tmp;
|
||||
tmp.add(Value(self.isInt() ? int64_t(self.getInt()-1) :
|
||||
uint64_t(self.getUInt()-1)));
|
||||
*this = tmp.slice();
|
||||
} catch (std::exception const& e) {
|
||||
return false;
|
||||
tmp.add(Value(-1));
|
||||
}
|
||||
*this = tmp.slice();
|
||||
return true;
|
||||
} else if (oper == "push") { // Push
|
||||
if (!slice.hasKey("new")) {
|
||||
|
|
Loading…
Reference in New Issue