mirror of https://gitee.com/bigwinds/arangodb
Fix bugs in Transaction replace method for babies.
This commit is contained in:
parent
738e595df3
commit
9da16d66a0
|
@ -990,7 +990,7 @@ OperationResult Transaction::replace(std::string const& collectionName,
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!oldValue.isArray() ^ !newValue.isArray()) ||
|
if ((oldValue.isArray() ^ newValue.isArray()) ||
|
||||||
(oldValue.isArray() && oldValue.length() != newValue.length())) {
|
(oldValue.isArray() && oldValue.length() != newValue.length())) {
|
||||||
// must provide two lists or two single documents
|
// must provide two lists or two single documents
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
|
||||||
|
@ -1111,7 +1111,7 @@ OperationResult Transaction::replaceLocal(std::string const& collectionName,
|
||||||
builder.clear();
|
builder.clear();
|
||||||
{
|
{
|
||||||
VPackObjectBuilder b(&builder);
|
VPackObjectBuilder b(&builder);
|
||||||
VPackObjectIterator it(newValue);
|
VPackObjectIterator it(newVal);
|
||||||
while (it.valid()) {
|
while (it.valid()) {
|
||||||
// let all but the system attributes pass
|
// let all but the system attributes pass
|
||||||
std::string k = it.key().copyString();
|
std::string k = it.key().copyString();
|
||||||
|
@ -1138,7 +1138,7 @@ OperationResult Transaction::replaceLocal(std::string const& collectionName,
|
||||||
TRI_DOC_UPDATE_ERROR,
|
TRI_DOC_UPDATE_ERROR,
|
||||||
expectedRevision, &actualRevision);
|
expectedRevision, &actualRevision);
|
||||||
|
|
||||||
res = document->replace(this, &oldValue, &sanitized, &mptr, &policy,
|
res = document->replace(this, &oldVal, &sanitized, &mptr, &policy,
|
||||||
options, !isLocked(document, TRI_TRANSACTION_WRITE));
|
options, !isLocked(document, TRI_TRANSACTION_WRITE));
|
||||||
|
|
||||||
if (res == TRI_ERROR_ARANGO_CONFLICT) {
|
if (res == TRI_ERROR_ARANGO_CONFLICT) {
|
||||||
|
|
Loading…
Reference in New Issue