mirror of https://gitee.com/bigwinds/arangodb
Removed unused obsolete Code and Imports
This commit is contained in:
parent
3f1d090ac7
commit
42e3d94bf6
|
@ -31,10 +31,8 @@
|
||||||
#include "Aql/QueryCache.h"
|
#include "Aql/QueryCache.h"
|
||||||
#include "Aql/QueryList.h"
|
#include "Aql/QueryList.h"
|
||||||
#include "Basics/Exceptions.h"
|
#include "Basics/Exceptions.h"
|
||||||
#include "Basics/JsonHelper.h"
|
|
||||||
#include "Basics/WorkMonitor.h"
|
#include "Basics/WorkMonitor.h"
|
||||||
#include "Basics/fasthash.h"
|
#include "Basics/fasthash.h"
|
||||||
#include "Basics/json.h"
|
|
||||||
#include "Basics/tri-strings.h"
|
#include "Basics/tri-strings.h"
|
||||||
#include "Basics/VelocyPackHelper.h"
|
#include "Basics/VelocyPackHelper.h"
|
||||||
#include "Cluster/ServerState.h"
|
#include "Cluster/ServerState.h"
|
||||||
|
@ -53,7 +51,6 @@
|
||||||
|
|
||||||
using namespace arangodb;
|
using namespace arangodb;
|
||||||
using namespace arangodb::aql;
|
using namespace arangodb::aql;
|
||||||
using Json = arangodb::basics::Json;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief empty string singleton
|
/// @brief empty string singleton
|
||||||
|
@ -228,9 +225,6 @@ Query::Query(arangodb::ApplicationV8* applicationV8,
|
||||||
_contextOwnedByExterior(contextOwnedByExterior),
|
_contextOwnedByExterior(contextOwnedByExterior),
|
||||||
_killed(false),
|
_killed(false),
|
||||||
_isModificationQuery(false) {
|
_isModificationQuery(false) {
|
||||||
// std::cout << TRI_CurrentThreadId() << ", QUERY " << this << " CTOR (JSON):
|
|
||||||
// " << _queryJson.toString() << "\n";
|
|
||||||
|
|
||||||
TRI_ASSERT(_vocbase != nullptr);
|
TRI_ASSERT(_vocbase != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +440,7 @@ void Query::registerWarning(int code, char const* details) {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief prepare an AQL query, this is a preparation for execute, but
|
/// @brief prepare an AQL query, this is a preparation for execute, but
|
||||||
/// execute calls it internally. The purpose of this separate method is
|
/// execute calls it internally. The purpose of this separate method is
|
||||||
/// to be able to only prepare a query from JSON and then store it in the
|
/// to be able to only prepare a query from VelocyPack and then store it in the
|
||||||
/// QueryRegistry.
|
/// QueryRegistry.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -485,9 +479,6 @@ QueryResult Query::prepare(QueryRegistry* registry) {
|
||||||
enterState(AST_OPTIMIZATION);
|
enterState(AST_OPTIMIZATION);
|
||||||
|
|
||||||
parser->ast()->validateAndOptimize();
|
parser->ast()->validateAndOptimize();
|
||||||
// std::cout << "AST: " <<
|
|
||||||
// arangodb::basics::JsonHelper::toString(parser->ast()->toJson(TRI_UNKNOWN_MEM_ZONE,
|
|
||||||
// false)) << "\n";
|
|
||||||
|
|
||||||
enterState(PLAN_INSTANTIATION);
|
enterState(PLAN_INSTANTIATION);
|
||||||
plan.reset(ExecutionPlan::instantiateFromAst(parser->ast()));
|
plan.reset(ExecutionPlan::instantiateFromAst(parser->ast()));
|
||||||
|
@ -538,22 +529,7 @@ QueryResult Query::prepare(QueryRegistry* registry) {
|
||||||
planRegisters = false;
|
planRegisters = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// std::cout << "GOT PLAN:\n" << plan.get()->toJson(parser->ast(),
|
|
||||||
// TRI_UNKNOWN_MEM_ZONE, true).toString() << "\n\n";
|
|
||||||
|
|
||||||
TRI_ASSERT(plan.get() != nullptr);
|
TRI_ASSERT(plan.get() != nullptr);
|
||||||
/* // for debugging of serialization/deserialization . . . * /
|
|
||||||
auto JsonPlan = plan->toJson(parser->ast(),TRI_UNKNOWN_MEM_ZONE, true);
|
|
||||||
auto JsonString = JsonPlan.toString();
|
|
||||||
std::cout << "original plan: \n" << JsonString << "\n";
|
|
||||||
|
|
||||||
auto otherPlan = ExecutionPlan::instantiateFromJson (parser->ast(),
|
|
||||||
JsonPlan);
|
|
||||||
otherPlan->getCost();
|
|
||||||
auto otherJsonString =
|
|
||||||
otherPlan->toJson(parser->ast(), TRI_UNKNOWN_MEM_ZONE, true).toString();
|
|
||||||
std::cout << "deserialized plan: \n" << otherJsonString << "\n";
|
|
||||||
//TRI_ASSERT(otherJsonString == JsonString); */
|
|
||||||
|
|
||||||
// varsUsedLater and varsValid are unordered_sets and so their orders
|
// varsUsedLater and varsValid are unordered_sets and so their orders
|
||||||
// are not the same in the serialized and deserialized plans
|
// are not the same in the serialized and deserialized plans
|
||||||
|
@ -809,13 +785,7 @@ QueryResultV8 Query::executeV8(v8::Isolate* isolate, QueryRegistry* registry) {
|
||||||
if (!val.isEmpty()) {
|
if (!val.isEmpty()) {
|
||||||
result.result->Set(j++, val.toV8(isolate, _trx, doc));
|
result.result->Set(j++, val.toV8(isolate, _trx, doc));
|
||||||
|
|
||||||
auto json = val.toJson(_trx, doc, true);
|
val.toVelocyPack(_trx, doc, *builder);
|
||||||
int res = arangodb::basics::JsonHelper::toVelocyPack(json.json(), *(builder.get()));
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
delete value;
|
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete value;
|
delete value;
|
||||||
|
@ -932,9 +902,6 @@ QueryResult Query::explain() {
|
||||||
enterState(AST_OPTIMIZATION);
|
enterState(AST_OPTIMIZATION);
|
||||||
// optimize and validate the ast
|
// optimize and validate the ast
|
||||||
parser.ast()->validateAndOptimize();
|
parser.ast()->validateAndOptimize();
|
||||||
// std::cout << "AST: " <<
|
|
||||||
// arangodb::basics::JsonHelper::toString(parser.ast()->toJson(TRI_UNKNOWN_MEM_ZONE))
|
|
||||||
// << "\n";
|
|
||||||
|
|
||||||
// create the transaction object, but do not start it yet
|
// create the transaction object, but do not start it yet
|
||||||
_trx = new arangodb::AqlTransaction(createTransactionContext(),
|
_trx = new arangodb::AqlTransaction(createTransactionContext(),
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#define ARANGOD_AQL_QUERY_H 1
|
#define ARANGOD_AQL_QUERY_H 1
|
||||||
|
|
||||||
#include "Basics/Common.h"
|
#include "Basics/Common.h"
|
||||||
#include "Basics/JsonHelper.h"
|
|
||||||
#include "Aql/BindParameters.h"
|
#include "Aql/BindParameters.h"
|
||||||
#include "Aql/Collections.h"
|
#include "Aql/Collections.h"
|
||||||
#include "Aql/QueryResultV8.h"
|
#include "Aql/QueryResultV8.h"
|
||||||
|
@ -277,7 +276,7 @@ class Query {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief prepare an AQL query, this is a preparation for execute, but
|
/// @brief prepare an AQL query, this is a preparation for execute, but
|
||||||
/// execute calls it internally. The purpose of this separate method is
|
/// execute calls it internally. The purpose of this separate method is
|
||||||
/// to be able to only prepare a query from JSON and then store it in the
|
/// to be able to only prepare a query from VelocyPack and then store it in the
|
||||||
/// QueryRegistry.
|
/// QueryRegistry.
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#define ARANGOD_AQL_QUERY_RESULT_H 1
|
#define ARANGOD_AQL_QUERY_RESULT_H 1
|
||||||
|
|
||||||
#include "Basics/Common.h"
|
#include "Basics/Common.h"
|
||||||
#include "Basics/json.h"
|
|
||||||
|
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
namespace velocypack {
|
namespace velocypack {
|
||||||
|
@ -45,11 +44,9 @@ struct QueryResult {
|
||||||
stats.swap(other.stats);
|
stats.swap(other.stats);
|
||||||
profile.swap(other.profile);
|
profile.swap(other.profile);
|
||||||
|
|
||||||
clusterplan = other.clusterplan;
|
|
||||||
bindParameters = other.bindParameters;
|
bindParameters = other.bindParameters;
|
||||||
collectionNames = other.collectionNames;
|
collectionNames = other.collectionNames;
|
||||||
|
|
||||||
other.clusterplan = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryResult(int code, std::string const& details)
|
QueryResult(int code, std::string const& details)
|
||||||
|
@ -58,8 +55,7 @@ struct QueryResult {
|
||||||
details(details),
|
details(details),
|
||||||
warnings(nullptr),
|
warnings(nullptr),
|
||||||
result(nullptr),
|
result(nullptr),
|
||||||
profile(nullptr),
|
profile(nullptr) {}
|
||||||
clusterplan(nullptr) {}
|
|
||||||
|
|
||||||
explicit QueryResult(int code) : QueryResult(code, "") {}
|
explicit QueryResult(int code) : QueryResult(code, "") {}
|
||||||
|
|
||||||
|
@ -77,7 +73,6 @@ struct QueryResult {
|
||||||
std::shared_ptr<arangodb::velocypack::Builder> result;
|
std::shared_ptr<arangodb::velocypack::Builder> result;
|
||||||
std::shared_ptr<arangodb::velocypack::Builder> stats;
|
std::shared_ptr<arangodb::velocypack::Builder> stats;
|
||||||
std::shared_ptr<arangodb::velocypack::Builder> profile;
|
std::shared_ptr<arangodb::velocypack::Builder> profile;
|
||||||
TRI_json_t* clusterplan;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1158,11 +1158,6 @@ static void JS_ExplainAql(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||||
v8::Boolean::New(isolate, queryResult.cached));
|
v8::Boolean::New(isolate, queryResult.cached));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queryResult.clusterplan != nullptr) {
|
|
||||||
result->Set(TRI_V8_ASCII_STRING("clusterplans"),
|
|
||||||
TRI_ObjectJson(isolate, queryResult.clusterplan));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queryResult.warnings == nullptr) {
|
if (queryResult.warnings == nullptr) {
|
||||||
result->Set(TRI_V8_ASCII_STRING("warnings"), v8::Array::New(isolate));
|
result->Set(TRI_V8_ASCII_STRING("warnings"), v8::Array::New(isolate));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue