mirror of https://gitee.com/bigwinds/arangodb
Put in tests to check for existence of _from and _to in edges.
This commit is contained in:
parent
fc44d4af6f
commit
a9be9b4fdb
|
@ -1483,7 +1483,7 @@ static void ModifyVocbaseCol(TRI_voc_document_operation_e operation,
|
|||
auto workOnOneSearchVal = [&](v8::Local<v8::Value> const searchVal) {
|
||||
std::string collName;
|
||||
if (!ExtractDocumentHandle(isolate, searchVal, collName,
|
||||
updateBuilder, false)) {
|
||||
updateBuilder, true)) {
|
||||
TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3305,6 +3305,18 @@ int TRI_document_collection_t::insert(Transaction* trx, VPackSlice const* slice,
|
|||
TRI_doc_mptr_t* mptr,
|
||||
OperationOptions& options,
|
||||
bool lock) {
|
||||
|
||||
if (_info.type() == TRI_COL_TYPE_EDGE) {
|
||||
VPackSlice s = slice->get(TRI_VOC_ATTRIBUTE_FROM);
|
||||
if (!s.isString()) {
|
||||
return TRI_ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE;
|
||||
}
|
||||
s = slice->get(TRI_VOC_ATTRIBUTE_TO);
|
||||
if (!s.isString()) {
|
||||
return TRI_ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE;
|
||||
}
|
||||
}
|
||||
|
||||
TRI_ASSERT(mptr != nullptr);
|
||||
mptr->setDataPtr(nullptr);
|
||||
|
||||
|
@ -3497,6 +3509,18 @@ int TRI_document_collection_t::replace(Transaction* trx,
|
|||
OperationOptions& options,
|
||||
bool lock,
|
||||
TRI_voc_rid_t& prevRev) {
|
||||
|
||||
if (_info.type() == TRI_COL_TYPE_EDGE) {
|
||||
VPackSlice s = newSlice.get(TRI_VOC_ATTRIBUTE_FROM);
|
||||
if (!s.isString()) {
|
||||
return TRI_ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE;
|
||||
}
|
||||
s = newSlice.get(TRI_VOC_ATTRIBUTE_TO);
|
||||
if (!s.isString()) {
|
||||
return TRI_ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize the result
|
||||
TRI_ASSERT(mptr != nullptr);
|
||||
mptr->setDataPtr(nullptr);
|
||||
|
|
Loading…
Reference in New Issue