mirror of https://gitee.com/bigwinds/arangodb
Use a BuilderLeaser in VertexIdToData
This commit is contained in:
parent
5e4667969a
commit
e0850c1313
|
@ -1703,17 +1703,15 @@ static void JS_ThrowCollectionNotLoaded(
|
||||||
static v8::Handle<v8::Value> VertexIdToData(v8::Isolate* isolate,
|
static v8::Handle<v8::Value> VertexIdToData(v8::Isolate* isolate,
|
||||||
Transaction* trx,
|
Transaction* trx,
|
||||||
std::string const& vertexId) {
|
std::string const& vertexId) {
|
||||||
OperationOptions options;
|
|
||||||
size_t pos = vertexId.find('/');
|
size_t pos = vertexId.find('/');
|
||||||
TRI_ASSERT(pos != std::string::npos); // All are internal _id attributes
|
TRI_ASSERT(pos != std::string::npos); // All are internal _id attributes
|
||||||
|
|
||||||
VPackBuilder builder;
|
TransactionBuilderLeaser builder(trx);
|
||||||
builder.openObject();
|
builder->openObject();
|
||||||
builder.add(StaticStrings::KeyString, VPackValue(vertexId.substr(pos + 1)));
|
builder->add(StaticStrings::KeyString, VPackValue(vertexId.substr(pos + 1)));
|
||||||
builder.close();
|
builder->close();
|
||||||
|
|
||||||
// TODO Operation Result is very expensive find a faster alternative
|
OperationResult opRes = trx->document(vertexId.substr(0, pos), builder->slice(), options);
|
||||||
OperationResult opRes = trx->document(vertexId.substr(0, pos), builder.slice(), options);
|
|
||||||
|
|
||||||
if (opRes.failed()) {
|
if (opRes.failed()) {
|
||||||
v8::EscapableHandleScope scope(isolate);
|
v8::EscapableHandleScope scope(isolate);
|
||||||
|
|
Loading…
Reference in New Issue