1
0
Fork 0

Merge branch 'aql2' of ssh://github.com/triAGENS/ArangoDB into aql2

This commit is contained in:
James 2014-08-07 16:45:29 +02:00
commit 67ce79aa63
24 changed files with 515 additions and 769 deletions

View File

@ -35,7 +35,14 @@ using namespace triagens::aql;
ExecutionBlock::~ExecutionBlock () {
}
int ExecutionBlock::bind (std::map<std::string, struct TRI_json_s*>* params) {
int ExecutionBlock::bind (AqlItemBlock* items, size_t pos) {
int res;
for (auto d : _dependencies) {
res = d->bind(items, pos);
if (res != TRI_ERROR_NO_ERROR) {
return res;
}
}
return TRI_ERROR_NO_ERROR;
}
@ -51,10 +58,8 @@ void ExecutionBlock::walk (WalkerWorker* worker) {
worker->before(this);
// Now the children in their natural order:
for (auto it = _dependencies.begin();
it != _dependencies.end();
++it) {
(*it)->walk(worker);
for (auto c : _dependencies) {
c->walk(worker);
}
// Now handle a subquery:
if (_exeNode->getType() == ExecutionNode::SUBQUERY) {

View File

@ -191,10 +191,10 @@ namespace triagens {
// Copy constructor used for a subquery:
VarOverview (VarOverview const& v)
: varInfo(v.varInfo), nrRegsHere(v.nrRegs), nrRegs(v.nrRegs),
: varInfo(v.varInfo), nrRegsHere(v.nrRegsHere), nrRegs(v.nrRegs),
depth(v.depth+1), totalNrRegs(v.totalNrRegs), me(nullptr) {
nrRegsHere.push_back(0);
nrRegs.push_back(0);
nrRegs.push_back(nrRegs.back());
}
~VarOverview () {};
@ -294,11 +294,6 @@ namespace triagens {
v->setSharedPtr(&v);
walk(v.get());
v->reset();
std::cout << "Varinfo:\n";
for (auto x : v->varInfo) {
std::cout << x.first << " => " << x.second.depth << ","
<< x.second.registerId << std::endl;
}
}
////////////////////////////////////////////////////////////////////////////////
@ -334,13 +329,7 @@ namespace triagens {
/// @brief bind
////////////////////////////////////////////////////////////////////////////////
virtual int bind (std::map<std::string, struct TRI_json_s*>* params);
////////////////////////////////////////////////////////////////////////////////
/// @brief getParameters
////////////////////////////////////////////////////////////////////////////////
std::map<std::string, struct TRI_json_s*>* getParameters ();
virtual int bind (AqlItemBlock* items, size_t pos);
////////////////////////////////////////////////////////////////////////////////
/// @brief execute
@ -400,36 +389,9 @@ namespace triagens {
public:
virtual AqlItemBlock* getOne () {
if (_done) {
return nullptr;
}
if (_buffer.empty()) {
if (! getBlock(1, DefaultBatchSize)) {
_done = true;
return nullptr;
}
_pos = 0;
}
TRI_ASSERT(! _buffer.empty());
// Here, _buffer.size() is > 0 and _pos points to a valid place
// in it.
AqlItemBlock* res;
AqlItemBlock* cur;
cur = _buffer.front();
res = cur->slice(_pos, _pos + 1);
_pos++;
if (_pos >= cur->size()) {
_buffer.pop_front();
delete cur;
_pos = 0;
}
return res;
return getSome (1, 1);
}
virtual AqlItemBlock* getSome (size_t atLeast,
size_t atMost) {
if (_done) {
@ -645,7 +607,7 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
SingletonBlock (AQL_TRANSACTION_V8* trx, SingletonNode const* ep)
: ExecutionBlock(trx, ep) {
: ExecutionBlock(trx, ep), _inputRegisterValues(nullptr) {
}
////////////////////////////////////////////////////////////////////////////////
@ -660,9 +622,23 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
int initialize () {
_inputRegisterValues = nullptr; // just in case
return ExecutionBlock::initialize();
}
////////////////////////////////////////////////////////////////////////////////
/// @brief bind, store a copy of the register values coming from above
////////////////////////////////////////////////////////////////////////////////
int bind (AqlItemBlock* items, size_t pos) {
// Create a deep copy of the register values given to us:
if (_inputRegisterValues != nullptr) {
delete _inputRegisterValues;
}
_inputRegisterValues = items->slice(pos, pos+1);
return TRI_ERROR_NO_ERROR;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief execute, just call base class
////////////////////////////////////////////////////////////////////////////////
@ -676,20 +652,11 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
int shutdown () {
return ExecutionBlock::shutdown();
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getOne
////////////////////////////////////////////////////////////////////////////////
AqlItemBlock* getOne () {
if (_done) {
return nullptr;
int res = ExecutionBlock::shutdown();
if (_inputRegisterValues != nullptr) {
delete _inputRegisterValues;
_inputRegisterValues = nullptr;
}
AqlItemBlock* res(new AqlItemBlock(1, _varOverview->nrRegs[_depth]));
_done = true;
return res;
}
@ -697,12 +664,21 @@ namespace triagens {
/// @brief getSome
////////////////////////////////////////////////////////////////////////////////
AqlItemBlock* getSome (size_t atLeast, size_t atMost) {
AqlItemBlock* getSome (size_t, size_t) {
if (_done) {
return nullptr;
}
AqlItemBlock* res(new AqlItemBlock(1, _varOverview->nrRegs[_depth]));
AqlItemBlock* res = new AqlItemBlock(1, _varOverview->nrRegs[_depth]);
if (_inputRegisterValues != nullptr) {
for (RegisterId reg = 0; reg < _inputRegisterValues->getNrRegs(); ++reg) {
res->setValue(0, reg, _inputRegisterValues->getValue(0, reg));
_inputRegisterValues->eraseValue(0, reg);
res->setDocumentCollection(reg,
_inputRegisterValues->getDocumentCollection(reg));
}
}
_done = true;
return res;
}
@ -745,6 +721,14 @@ namespace triagens {
return _done ? 0 : 1;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief the bind data coming from outside
////////////////////////////////////////////////////////////////////////////////
private:
AqlItemBlock* _inputRegisterValues;
};
@ -875,60 +859,6 @@ namespace triagens {
return res;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getOne
////////////////////////////////////////////////////////////////////////////////
AqlItemBlock* getOne () {
if (_done) {
return nullptr;
}
if (_buffer.empty()) {
if (! ExecutionBlock::getBlock(1, DefaultBatchSize)) {
_done = true;
return nullptr;
}
_pos = 0; // this is in the first block
_posInAllDocs = 0; // Note that we know _allDocs.size() > 0,
// otherwise _done would be true already
}
// If we get here, we do have _buffer.front()
AqlItemBlock* cur = _buffer.front();
// Copy stuff from frames above:
auto res = new AqlItemBlock(1, _varOverview->nrRegs[_depth]);
TRI_ASSERT(cur->getNrRegs() <= res->getNrRegs());
for (RegisterId i = 0; i < cur->getNrRegs(); i++) {
res->setValue(0, i, cur->getValue(_pos, i).clone());
}
// The result is in the first variable of this depth,
// we do not need to do a lookup in _varOverview->varInfo,
// but can just take cur->getNrRegs() as registerId:
res->setValue(0, cur->getNrRegs(), AqlValue(reinterpret_cast<TRI_df_marker_t const*>(_documents[_posInAllDocs++].getDataPtr())));
res->getDocumentCollections().at(cur->getNrRegs())
= _trx->documentCollection();
// Advance read position:
if (_posInAllDocs >= _documents.size()) {
// we have exhausted our local documents buffer
_posInAllDocs = 0;
// fetch more documents into our buffer
if (! moreDocuments()) {
initDocuments();
if (++_pos >= cur->size()) {
_buffer.pop_front();
delete cur;
_pos = 0;
}
}
}
return res;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getSome
////////////////////////////////////////////////////////////////////////////////
@ -1333,29 +1263,6 @@ namespace triagens {
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getOne
////////////////////////////////////////////////////////////////////////////////
public:
virtual AqlItemBlock* getOne () {
AqlItemBlock* res = ExecutionBlock::getOne();
if (res == nullptr) {
return nullptr;
}
try {
doEvaluation(res);
return res;
}
catch (...) {
delete res;
throw;
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getSome
////////////////////////////////////////////////////////////////////////////////
@ -1491,41 +1398,6 @@ namespace triagens {
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getOne
////////////////////////////////////////////////////////////////////////////////
AqlItemBlock* getOne () {
if (_done) {
return nullptr;
}
if (_buffer.empty()) {
if (! getBlock(1, DefaultBatchSize)) {
_done = true;
return nullptr;
}
_pos = 0;
}
TRI_ASSERT(_buffer.size() > 0);
// Here, _buffer.size() is > 0 and _pos points to a valid place
// in it.
AqlItemBlock* res;
AqlItemBlock* cur;
cur = _buffer.front();
res = cur->slice(_chosen[_pos], _chosen[_pos+ 1]);
_pos++;
if (_pos >= _chosen.size()) {
_buffer.pop_front();
delete cur;
_pos = 0;
}
return res;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getSome
////////////////////////////////////////////////////////////////////////////////
@ -1884,44 +1756,6 @@ namespace triagens {
return TRI_ERROR_NO_ERROR;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getOne
////////////////////////////////////////////////////////////////////////////////
virtual AqlItemBlock* getOne () {
if (_state == 2) {
return nullptr;
}
if (_state == 0) {
if (_offset > 0) {
ExecutionBlock::skip(_offset);
_state = 1;
_count = 0;
if (_limit == 0) {
_state = 2;
return nullptr;
}
}
}
// If we get to here, _state == 1 and _count < _limit
// Fetch one from above, possibly using our _buffer:
auto res = ExecutionBlock::getOne();
if (res == nullptr) {
_state = 2;
return res;
}
TRI_ASSERT(res->size() == 1);
if (++_count >= _limit) {
_state = 2;
}
return res;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getSome
////////////////////////////////////////////////////////////////////////////////
@ -2014,32 +1848,6 @@ namespace triagens {
~ReturnBlock () {
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getOne
////////////////////////////////////////////////////////////////////////////////
virtual AqlItemBlock* getOne () {
// Fetch one from above, possibly using our _buffer:
auto res = ExecutionBlock::getOne();
if (res == nullptr) {
return res;
}
TRI_ASSERT(res->size() == 1);
// Let's steal the actual result and throw away the vars:
AqlItemBlock* stripped = new AqlItemBlock(1, 1);
auto ep = static_cast<ReturnNode const*>(getPlanNode());
auto it = _varOverview->varInfo.find(ep->_inVariable->id);
TRI_ASSERT(it != _varOverview->varInfo.end());
RegisterId registerId = it->second.registerId;
stripped->setValue(0, 0, res->getValue(0, registerId));
res->eraseValue(0, registerId);
stripped->setDocumentCollection(0, res->getDocumentCollection(registerId));
delete res;
return stripped;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief getSome
////////////////////////////////////////////////////////////////////////////////

View File

@ -68,7 +68,7 @@ namespace triagens {
CALCULATION, // done
SUBQUERY, // done
SORT, // done
AGGREGATE, // todo
AGGREGATE, // done
LOOKUP_JOIN,
MERGE_JOIN,
LOOKUP_INDEX_UNIQUE,
@ -1025,6 +1025,7 @@ namespace triagens {
AggregateNode (std::vector<std::pair<Variable const*, Variable const*>> aggregateVariables,
Variable const* outVariable)
: ExecutionNode(), _aggregateVariables(aggregateVariables), _outVariable(outVariable) {
// outVariable can be a nullptr
}
////////////////////////////////////////////////////////////////////////////////
@ -1068,7 +1069,7 @@ namespace triagens {
private:
////////////////////////////////////////////////////////////////////////////////
/// @brief input/output variables for the aggregation (out = in)
/// @brief input/output variables for the aggregation (out, in)
////////////////////////////////////////////////////////////////////////////////
std::vector<std::pair<Variable const*, Variable const*>> _aggregateVariables;

180
arangod/Aql/Function.cpp Normal file
View File

@ -0,0 +1,180 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief Aql, built-in AQL function
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2012-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "Aql/Function.h"
#include "Utils/Exception.h"
using namespace triagens::aql;
// -----------------------------------------------------------------------------
// --SECTION-- constructors / destructors
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief create the function
////////////////////////////////////////////////////////////////////////////////
Function::Function (std::string const& name,
std::string const& arguments,
bool isDeterministic)
: name(name),
arguments(arguments),
isDeterministic(isDeterministic),
containsCollectionParameter(false) {
initArguments();
}
////////////////////////////////////////////////////////////////////////////////
/// @brief destroy the function
////////////////////////////////////////////////////////////////////////////////
Function::~Function () {
}
// -----------------------------------------------------------------------------
// --SECTION-- public methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not a positional argument needs to be converted from a
/// collection parameter to a collection name parameter
////////////////////////////////////////////////////////////////////////////////
bool Function::mustConvertArgument (size_t position) const {
bool foundArg = false;
size_t i = 0;
char const* p = arguments.c_str();
while (true) {
char const c = *p++;
switch (c) {
case '\0':
return false;
case '|':
case ',':
if (foundArg) {
if (++i > position) {
return false;
}
}
foundArg = false;
break;
case 'h':
if (i == position) {
// found an argument to convert
return true;
}
foundArg = true;
break;
default:
foundArg = true;
}
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief parse the argument list and set the minimum and maximum number of
/// arguments
////////////////////////////////////////////////////////////////////////////////
void Function::initArguments () {
minRequiredArguments = maxRequiredArguments = 0;
// setup some parsing state
bool inOptional = false;
bool foundArg = false;
char const* p = arguments.c_str();
while (true) {
char const c = *p++;
switch (c) {
case '\0':
// end of argument list
if (foundArg) {
if (! inOptional) {
++minRequiredArguments;
}
++maxRequiredArguments;
}
return;
case '|':
// beginning of optional arguments
TRI_ASSERT(! inOptional);
if (foundArg) {
++minRequiredArguments;
++maxRequiredArguments;
}
inOptional = true;
foundArg = false;
break;
case ',':
// next argument
TRI_ASSERT(foundArg);
if (! inOptional) {
++minRequiredArguments;
}
++maxRequiredArguments;
foundArg = false;
break;
case '+':
// repeated optional argument
TRI_ASSERT(inOptional);
maxRequiredArguments = MaxArguments;
return;
default:
if (c == 'h') {
// note that we found a collection parameter
containsCollectionParameter = true;
}
foundArg = true;
}
}
}
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -1,5 +1,5 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief Aql, built-in function
/// @brief Aql, built-in AQL function
///
/// @file
///
@ -43,19 +43,20 @@ namespace triagens {
Function () = delete;
Function (std::string const& name,
std::string const& arguments,
bool isDeterministic)
: name(name),
arguments(arguments),
isDeterministic(isDeterministic) {
////////////////////////////////////////////////////////////////////////////////
/// @brief create the function
////////////////////////////////////////////////////////////////////////////////
initArguments();
}
Function (std::string const&,
std::string const&,
bool);
~Function () {
}
////////////////////////////////////////////////////////////////////////////////
/// @brief destroy the function
////////////////////////////////////////////////////////////////////////////////
~Function ();
// -----------------------------------------------------------------------------
// --SECTION-- public methods
// -----------------------------------------------------------------------------
@ -77,67 +78,20 @@ namespace triagens {
return std::make_pair(minRequiredArguments, maxRequiredArguments);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not a positional argument needs to be converted from a
/// collection parameter to a collection name parameter
////////////////////////////////////////////////////////////////////////////////
bool mustConvertArgument (size_t) const;
////////////////////////////////////////////////////////////////////////////////
/// @brief parse the argument list and set the minimum and maximum number of
/// arguments
////////////////////////////////////////////////////////////////////////////////
void initArguments () {
minRequiredArguments = maxRequiredArguments = 0;
// setup some parsing state
bool inOptional = false;
bool foundArg = false;
char const* p = arguments.c_str();
while (true) {
char const c = *p++;
switch (c) {
case '\0':
// end of argument list
if (foundArg) {
if (! inOptional) {
++minRequiredArguments;
}
++maxRequiredArguments;
}
return;
case '|':
// beginning of optional arguments
TRI_ASSERT(! inOptional);
if (foundArg) {
++minRequiredArguments;
++maxRequiredArguments;
}
inOptional = true;
foundArg = false;
break;
case ',':
// next argument
TRI_ASSERT(foundArg);
if (! inOptional) {
++minRequiredArguments;
}
++maxRequiredArguments;
foundArg = false;
break;
case '+':
// repeated optional argument
TRI_ASSERT(inOptional);
maxRequiredArguments = MaxArguments;
return;
default:
foundArg = true;
}
}
}
void initArguments ();
// -----------------------------------------------------------------------------
// --SECTION-- public variables
// -----------------------------------------------------------------------------
@ -161,6 +115,13 @@ namespace triagens {
bool const isDeterministic;
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not the function contains a collection parameter that
/// will cause some special conversion during function calls
////////////////////////////////////////////////////////////////////////////////
bool containsCollectionParameter;
////////////////////////////////////////////////////////////////////////////////
/// @brief minimum number of required arguments
////////////////////////////////////////////////////////////////////////////////

View File

@ -404,6 +404,18 @@ void V8Executor::generateCodeExpression (AstNode const* node) {
_buffer->appendText("; })");
}
////////////////////////////////////////////////////////////////////////////////
/// @brief generates code for a string value
////////////////////////////////////////////////////////////////////////////////
void V8Executor::generateCodeString (char const* value) {
TRI_ASSERT(value != nullptr);
_buffer->appendChar('"');
_buffer->appendJsonEncoded(value);
_buffer->appendChar('"');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief generate JavaScript code for a list
////////////////////////////////////////////////////////////////////////////////
@ -440,11 +452,12 @@ void V8Executor::generateCodeArray (AstNode const* node) {
}
auto member = node->getMember(i);
_buffer->appendText("\"");
_buffer->appendJsonEncoded(member->getStringValue());
_buffer->appendText("\" : ");
generateCodeNode(member->getMember(0));
if (member != nullptr) {
generateCodeString(member->getStringValue());
_buffer->appendText(" : ");
generateCodeNode(member->getMember(0));
}
}
_buffer->appendText(" }");
}
@ -547,9 +560,9 @@ void V8Executor::generateCodeReference (AstNode const* node) {
auto variable = static_cast<Variable*>(node->getData());
_buffer->appendText("vars[\"");
_buffer->appendJsonEncoded(variable->name.c_str());
_buffer->appendText("\"]");
_buffer->appendText("vars[");
generateCodeString(variable->name.c_str());
_buffer->appendText("]");
}
////////////////////////////////////////////////////////////////////////////////
@ -561,10 +574,10 @@ void V8Executor::generateCodeVariable (AstNode const* node) {
TRI_ASSERT(node->numMembers() == 0);
auto variable = static_cast<Variable*>(node->getData());
_buffer->appendText("vars[\"");
_buffer->appendJsonEncoded(variable->name.c_str());
_buffer->appendText("\"]");
_buffer->appendText("vars[");
generateCodeString(variable->name.c_str());
_buffer->appendText("]");
}
////////////////////////////////////////////////////////////////////////////////
@ -577,9 +590,9 @@ void V8Executor::generateCodeCollection (AstNode const* node) {
char const* name = node->getStringValue();
_buffer->appendText("aql.GET_DOCUMENTS(\"");
_buffer->appendJsonEncoded(name);
_buffer->appendText("\")");
_buffer->appendText("aql.GET_DOCUMENTS(");
generateCodeString(name);
_buffer->appendText(")");
}
////////////////////////////////////////////////////////////////////////////////
@ -606,7 +619,20 @@ void V8Executor::generateCodeFunctionCall (AstNode const* node) {
_buffer->appendText(", ");
}
generateCodeNode(args->getMember(i));
auto member = args->getMember(i);
if (member != nullptr) {
if (member->type == NODE_TYPE_COLLECTION &&
func->containsCollectionParameter) {
// do a parameter conversion from a collection parameter to a collection name parameter
char const* name = member->getStringValue();
generateCodeString(name);
}
else {
// generate regular code for the node
generateCodeNode(args->getMember(i));
}
}
}
_buffer->appendText(")");
}
@ -626,9 +652,9 @@ void V8Executor::generateCodeUserFunctionCall (AstNode const* node) {
TRI_ASSERT(args != nullptr);
TRI_ASSERT(args->type == NODE_TYPE_LIST);
_buffer->appendText("aql.FCALL_USER(\"");
_buffer->appendJsonEncoded(name);
_buffer->appendText("\", [");
_buffer->appendText("aql.FCALL_USER(");
generateCodeString(name);
_buffer->appendText(", [");
size_t const n = args->numMembers();
for (size_t i = 0; i < n; ++i) {
@ -693,9 +719,9 @@ void V8Executor::generateCodeNamedAccess (AstNode const* node) {
_buffer->appendText("aql.DOCUMENT_MEMBER(");
generateCodeNode(node->getMember(0));
_buffer->appendText(", \"");
_buffer->appendJsonEncoded(node->getStringValue());
_buffer->appendText("\")");
_buffer->appendText(", ");
generateCodeString(node->getStringValue());
_buffer->appendText(")");
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -114,6 +114,12 @@ namespace triagens {
void generateCodeExpression (AstNode const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief generates code for a string value
////////////////////////////////////////////////////////////////////////////////
void generateCodeString (char const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief generate JavaScript code for a list
////////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,113 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief Aql, V8 expression
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2012-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "Aql/V8Expression.h"
#include "Aql/V8Executor.h"
#include "BasicsC/json.h"
#include "V8/v8-conv.h"
using namespace triagens::aql;
// -----------------------------------------------------------------------------
// --SECTION-- constructors / destructors
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief create the v8 expression
////////////////////////////////////////////////////////////////////////////////
V8Expression::V8Expression (v8::Isolate* isolate,
v8::Persistent<v8::Function> func)
: isolate(isolate),
func(func) {
}
////////////////////////////////////////////////////////////////////////////////
/// @brief destroy the v8 expression
////////////////////////////////////////////////////////////////////////////////
V8Expression::~V8Expression () {
func.Dispose(isolate);
func.Clear();
}
// -----------------------------------------------------------------------------
// --SECTION-- public methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief execute the expression
////////////////////////////////////////////////////////////////////////////////
AqlValue V8Expression::execute (AQL_TRANSACTION_V8* trx,
std::vector<TRI_document_collection_t const*>& docColls,
std::vector<AqlValue>& argv,
size_t startPos,
std::vector<Variable*> const& vars,
std::vector<RegisterId> const& regs) {
size_t const n = vars.size();
TRI_ASSERT(regs.size() == n); // assert same vector length
v8::Handle<v8::Object> values = v8::Object::New();
for (size_t i = 0; i < n; ++i) {
auto varname = vars[i]->name;
auto reg = regs[i];
TRI_ASSERT(! argv[reg].isEmpty());
values->Set(v8::String::New(varname.c_str(), (int) varname.size()), argv[startPos + reg].toV8(trx, docColls[reg]));
}
// set function arguments
v8::Handle<v8::Value> args[] = { values };
// execute the function
v8::TryCatch tryCatch;
v8::Handle<v8::Value> result = func->Call(func, 1, args);
V8Executor::HandleV8Error(tryCatch, result);
TRI_json_t* json = TRI_ObjectToJson(result);
if (json == nullptr) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
}
return AqlValue(new triagens::basics::Json(TRI_UNKNOWN_MEM_ZONE, json));
}
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -1,5 +1,5 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief Aql, V8 execution context
/// @brief Aql, V8 expression
///
/// @file
///
@ -31,10 +31,7 @@
#define ARANGODB_AQL_V8_EXPRESSION_H 1
#include "Basics/Common.h"
#include "Basics/JsonHelper.h"
#include "BasicsC/json.h"
#include "Aql/Types.h"
#include "V8/v8-conv.h"
#include <v8.h>
namespace triagens {
@ -46,73 +43,46 @@ namespace triagens {
struct V8Expression {
// -----------------------------------------------------------------------------
// --SECTION-- constructors / destructors
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief create the v8 expression
////////////////////////////////////////////////////////////////////////////////
V8Expression (v8::Isolate* isolate,
v8::Persistent<v8::Function> func)
: isolate(isolate),
func(func) {
}
V8Expression (v8::Isolate*,
v8::Persistent<v8::Function>);
////////////////////////////////////////////////////////////////////////////////
/// @brief destroy the v8 expression
////////////////////////////////////////////////////////////////////////////////
~V8Expression () {
func.Dispose(isolate);
func.Clear();
}
~V8Expression ();
// -----------------------------------------------------------------------------
// --SECTION-- public methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief execute the expression
////////////////////////////////////////////////////////////////////////////////
AqlValue execute (AQL_TRANSACTION_V8* trx,
std::vector<TRI_document_collection_t const*>& docColls,
std::vector<AqlValue>& argv,
size_t startPos,
std::vector<Variable*> const& vars,
std::vector<RegisterId> const& regs) {
// TODO: decide whether a separate handle scope is needed
AqlValue execute (AQL_TRANSACTION_V8*,
std::vector<TRI_document_collection_t const*>&,
std::vector<AqlValue>&,
size_t,
std::vector<Variable*> const&,
std::vector<RegisterId> const&);
size_t const n = vars.size();
TRI_ASSERT(regs.size() == n); // assert same vector length
// -----------------------------------------------------------------------------
// --SECTION-- public variables
// -----------------------------------------------------------------------------
v8::Handle<v8::Object> values = v8::Object::New();
for (size_t i = 0; i < n; ++i) {
auto varname = vars[i]->name;
auto reg = regs[i];
v8::Isolate* isolate;
TRI_ASSERT(! argv[reg].isEmpty());
values->Set(v8::String::New(varname.c_str(), (int) varname.size()), argv[startPos + reg].toV8(trx, docColls[reg]));
}
// set function arguments
v8::Handle<v8::Value> args[] = { values };
// execute the function
v8::TryCatch tryCatch;
v8::Handle<v8::Value> result = func->Call(func, 1, args);
v8::Persistent<v8::Function> func;
V8Executor::HandleV8Error(tryCatch, result);
TRI_json_t* json = TRI_ObjectToJson(result);
if (json == nullptr) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
}
return AqlValue(new triagens::basics::Json(TRI_UNKNOWN_MEM_ZONE, json));
}
v8::Isolate* isolate;
v8::Persistent<v8::Function> func;
};
}

View File

@ -65,6 +65,7 @@ add_executable(
Aql/ExecutionNode.cpp
Aql/ExecutionPlan.cpp
Aql/Expression.cpp
Aql/Function.cpp
Aql/grammar.cpp
Aql/Parser.cpp
Aql/Query.cpp
@ -72,6 +73,7 @@ add_executable(
Aql/Types.cpp
Aql/tokens.cpp
Aql/V8Executor.cpp
Aql/V8Expression.cpp
Aql/Variable.cpp
Aql/VariableGenerator.cpp
BitIndexes/bitarray.cpp

View File

@ -46,6 +46,7 @@ arangod_libarangod_a_SOURCES = \
arangod/Aql/ExecutionNode.cpp \
arangod/Aql/ExecutionPlan.cpp \
arangod/Aql/Expression.cpp \
arangod/Aql/Function.cpp \
arangod/Aql/grammar.cpp \
arangod/Aql/Parser.cpp \
arangod/Aql/Query.cpp \
@ -53,6 +54,7 @@ arangod_libarangod_a_SOURCES = \
arangod/Aql/Types.cpp \
arangod/Aql/tokens.cpp \
arangod/Aql/V8Executor.cpp \
arangod/Aql/V8Expression.cpp \
arangod/Aql/Variable.cpp \
arangod/Aql/VariableGenerator.cpp \
arangod/BitIndexes/bitarray.cpp \

View File

@ -27,72 +27,29 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "v8-vocbase.h"
#include "v8-collection.h"
#include "v8-vocbaseprivate.h"
#include "Ahuacatl/ahuacatl-codegen.h"
#include "Ahuacatl/ahuacatl-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.h"
#include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/Query.h"
#include "Basics/StringUtils.h"
#include "Basics/Utf8Helper.h"
#include "BasicsC/conversions.h"
#include "BasicsC/files.h"
#include "BasicsC/json.h"
#include "BasicsC/json-utilities.h"
#include "BasicsC/logging.h"
#include "BasicsC/tri-strings.h"
#include "CapConstraint/cap-constraint.h"
#include "FulltextIndex/fulltext-index.h"
#include "HttpServer/ApplicationEndpointServer.h"
#include "Replication/InitialSyncer.h"
#include "Rest/SslInterface.h"
#include "ShapedJson/shape-accessor.h"
#include "ShapedJson/shaped-json.h"
#include "Utils/AhuacatlGuard.h"
#include "Utils/AhuacatlTransaction.h"
#include "Utils/DocumentHelper.h"
#include "Utils/transactions.h"
#include "Utils/V8ResolverGuard.h"
#include "V8/v8-conv.h"
#include "V8/v8-execution.h"
#include "V8/v8-utils.h"
#include "Wal/LogfileManager.h"
#include "VocBase/auth.h"
#include "VocBase/datafile.h"
#include "VocBase/document-collection.h"
#include "VocBase/edge-collection.h"
#include "VocBase/general-cursor.h"
#include "VocBase/key-generator.h"
#include "VocBase/replication-applier.h"
#include "VocBase/replication-dump.h"
#include "VocBase/server.h"
#include "VocBase/voc-shaper.h"
#include "VocBase/index.h"
#include "v8.h"
#include "V8/JSLoader.h"
#include "Basics/JsonHelper.h"
#include "Cluster/AgencyComm.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ClusterInfo.h"
#include "Cluster/ClusterMethods.h"
#include "Cluster/ServerState.h"
#include "unicode/timezone.h"
#include "unicode/utypes.h"
#include "unicode/datefmt.h"
#include "unicode/smpdtfmt.h"
#include "unicode/dtfmtsym.h"
#include "v8-vocbase.h"
#include "v8-vocbaseprivate.h"
#include "v8-vocindex.h"
#include "v8-collection.h"
using namespace std;
using namespace triagens::basics;

View File

@ -31,6 +31,10 @@
#ifndef ARANGODB_V8SERVER_V8__COLLECTION_H
#define ARANGODB_V8SERVER_V8__COLLECTION_H 1
#include "Basics/Common.h"
#include "v8-vocbase.h"
#include "Utils/CollectionNameResolver.h"
////////////////////////////////////////////////////////////////////////////////
/// @brief free a coordinator collection
////////////////////////////////////////////////////////////////////////////////

View File

@ -28,6 +28,7 @@
////////////////////////////////////////////////////////////////////////////////
#include "v8-query.h"
#include "v8-vocindex.h"
#include "BasicsC/logging.h"
#include "BasicsC/random.h"
@ -45,7 +46,6 @@
#include "V8Server/v8-vocbase.h"
#include "VocBase/edge-collection.h"
#include "VocBase/vocbase.h"
#include "v8-vocindex.h"
#include "v8-wrapshapedjson.h"
using namespace std;

View File

@ -27,69 +27,15 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "v8-vocbase.h"
#include "v8-vocbaseprivate.h"
#include "Ahuacatl/ahuacatl-codegen.h"
#include "Ahuacatl/ahuacatl-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.h"
#include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/Query.h"
#include "Basics/StringUtils.h"
#include "Basics/Utf8Helper.h"
#include "BasicsC/conversions.h"
#include "BasicsC/files.h"
#include "BasicsC/json.h"
#include "BasicsC/json-utilities.h"
#include "BasicsC/logging.h"
#include "BasicsC/tri-strings.h"
#include "CapConstraint/cap-constraint.h"
#include "FulltextIndex/fulltext-index.h"
#include "HttpServer/ApplicationEndpointServer.h"
#include "Replication/InitialSyncer.h"
#include "Rest/SslInterface.h"
#include "ShapedJson/shape-accessor.h"
#include "ShapedJson/shaped-json.h"
#include "Utils/AhuacatlGuard.h"
#include "Utils/AhuacatlTransaction.h"
#include "Utils/DocumentHelper.h"
#include "Utils/transactions.h"
#include "Utils/V8ResolverGuard.h"
#include "V8/v8-conv.h"
#include "V8/v8-execution.h"
#include "V8/v8-utils.h"
#include "Wal/LogfileManager.h"
#include "VocBase/auth.h"
#include "VocBase/datafile.h"
#include "VocBase/document-collection.h"
#include "VocBase/edge-collection.h"
#include "VocBase/general-cursor.h"
#include "VocBase/key-generator.h"
#include "VocBase/replication-applier.h"
#include "VocBase/replication-dump.h"
#include "VocBase/server.h"
#include "VocBase/voc-shaper.h"
#include "VocBase/index.h"
#include "v8.h"
#include "V8/JSLoader.h"
#include "Basics/JsonHelper.h"
#include "Cluster/AgencyComm.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ClusterInfo.h"
#include "Cluster/ClusterMethods.h"
#include "Cluster/ServerState.h"
#include "unicode/timezone.h"
#include "unicode/utypes.h"
#include "unicode/datefmt.h"
#include "unicode/smpdtfmt.h"
#include "unicode/dtfmtsym.h"
#include "v8-vocbaseprivate.h"
#include "Replication/InitialSyncer.h"
using namespace std;
using namespace triagens::basics;
@ -650,6 +596,7 @@ void TRI_InitV8replication (v8::Handle<v8::Context> context,
JSLoader* loader,
const size_t threadNumber,
TRI_v8_global_t* v8g){
// replication functions. not intended to be used by end users
TRI_AddGlobalFunctionVocbase(context, "REPLICATION_LOGGER_STATE", JS_StateLoggerReplication, true);
TRI_AddGlobalFunctionVocbase(context, "REPLICATION_LOGGER_CONFIGURE", JS_ConfigureLoggerReplication, true);
@ -663,6 +610,4 @@ void TRI_InitV8replication (v8::Handle<v8::Context> context,
TRI_AddGlobalFunctionVocbase(context, "REPLICATION_APPLIER_SHUTDOWN", JS_ShutdownApplierReplication, true);
TRI_AddGlobalFunctionVocbase(context, "REPLICATION_APPLIER_STATE", JS_StateApplierReplication, true);
TRI_AddGlobalFunctionVocbase(context, "REPLICATION_APPLIER_FORGET", JS_ForgetApplierReplication, true);
}

View File

@ -27,67 +27,10 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "v8-vocbase.h"
#include "Ahuacatl/ahuacatl-codegen.h"
#include "Ahuacatl/ahuacatl-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.h"
#include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/Query.h"
#include "Basics/StringUtils.h"
#include "Basics/Utf8Helper.h"
#include "BasicsC/conversions.h"
#include "BasicsC/files.h"
#include "BasicsC/json.h"
#include "BasicsC/json-utilities.h"
#include "BasicsC/logging.h"
#include "BasicsC/tri-strings.h"
#include "CapConstraint/cap-constraint.h"
#include "FulltextIndex/fulltext-index.h"
#include "HttpServer/ApplicationEndpointServer.h"
#include "Rest/SslInterface.h"
#include "ShapedJson/shape-accessor.h"
#include "ShapedJson/shaped-json.h"
#include "Utils/AhuacatlGuard.h"
#include "Utils/AhuacatlTransaction.h"
#include "Utils/DocumentHelper.h"
#include "Utils/transactions.h"
#include "Utils/V8ResolverGuard.h"
#include "V8/v8-conv.h"
#include "V8/v8-execution.h"
#include "V8/v8-utils.h"
#include "Wal/LogfileManager.h"
#include "VocBase/auth.h"
#include "VocBase/datafile.h"
#include "VocBase/document-collection.h"
#include "VocBase/edge-collection.h"
#include "VocBase/key-generator.h"
#include "VocBase/server.h"
#include "VocBase/voc-shaper.h"
#include "VocBase/index.h"
#include "v8.h"
#include "V8/JSLoader.h"
#include "Basics/JsonHelper.h"
#include "Cluster/AgencyComm.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ClusterInfo.h"
#include "Cluster/ClusterMethods.h"
#include "Cluster/ServerState.h"
#include "unicode/timezone.h"
#include "unicode/utypes.h"
#include "unicode/datefmt.h"
#include "unicode/smpdtfmt.h"
#include "unicode/dtfmtsym.h"
#include "v8-vocbaseprivate.h"
#include "v8-wrapshapedjson.h"
#include "v8-voccursor.h"
#include "Aql/ExecutionBlock.h"
#include "BasicsC/conversions.h"
#include "VocBase/key-generator.h"
using namespace std;
using namespace triagens::basics;

View File

@ -27,52 +27,29 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "v8-vocbase.h"
#include "v8-vocbaseprivate.h"
#include "v8-wrapshapedjson.h"
#include "v8-voccursor.h"
#include "v8-collection.h"
#include "Ahuacatl/ahuacatl-codegen.h"
#include "Ahuacatl/ahuacatl-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.h"
#include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/Query.h"
#include "Basics/StringUtils.h"
#include "Basics/Utf8Helper.h"
#include "BasicsC/conversions.h"
#include "BasicsC/files.h"
#include "BasicsC/json.h"
#include "BasicsC/json-utilities.h"
#include "BasicsC/logging.h"
#include "BasicsC/tri-strings.h"
#include "CapConstraint/cap-constraint.h"
#include "FulltextIndex/fulltext-index.h"
#include "HttpServer/ApplicationEndpointServer.h"
#include "Rest/SslInterface.h"
#include "ShapedJson/shape-accessor.h"
#include "ShapedJson/shaped-json.h"
#include "Utils/AhuacatlGuard.h"
#include "Utils/AhuacatlTransaction.h"
#include "Utils/DocumentHelper.h"
#include "Utils/transactions.h"
#include "Utils/V8ResolverGuard.h"
#include "V8/v8-conv.h"
#include "V8/v8-execution.h"
#include "V8/v8-utils.h"
#include "Wal/LogfileManager.h"
#include "VocBase/auth.h"
#include "VocBase/datafile.h"
#include "VocBase/document-collection.h"
#include "VocBase/edge-collection.h"
#include "VocBase/key-generator.h"
#include "VocBase/server.h"
#include "VocBase/voc-shaper.h"
#include "VocBase/index.h"
#include "v8.h"
#include "V8/JSLoader.h"
#include "Basics/JsonHelper.h"
#include "Cluster/AgencyComm.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ClusterInfo.h"
@ -80,15 +57,9 @@
#include "Cluster/ServerState.h"
#include "unicode/timezone.h"
#include "unicode/utypes.h"
#include "unicode/datefmt.h"
#include "unicode/smpdtfmt.h"
#include "unicode/dtfmtsym.h"
#include "v8-vocbaseprivate.h"
#include "v8-wrapshapedjson.h"
#include "v8-voccursor.h"
#include "v8-collection.h"
using namespace std;
using namespace triagens::basics;

View File

@ -30,6 +30,12 @@
#ifndef ARANGODB_V8SERVER_V8__VOCBASE_PRIVATE_H
#define ARANGODB_V8SERVER_V8__VOCBASE_PRIVATE_H
#include "Basics/Common.h"
#include "V8/v8-utils.h"
#include "v8-vocbase.h"
#include "Ahuacatl/ahuacatl-error.h"
////////////////////////////////////////////////////////////////////////////////
/// @brief wrapped class for TRI_vocbase_t
///

View File

@ -27,70 +27,17 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "v8-vocbase.h"
#include "v8-voccursor.h"
#include "v8-vocbaseprivate.h"
#include "VocBase/general-cursor.h"
#include "Ahuacatl/ahuacatl-codegen.h"
#include "Ahuacatl/ahuacatl-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.h"
#include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/Query.h"
#include "Basics/StringUtils.h"
#include "Basics/Utf8Helper.h"
#include "BasicsC/conversions.h"
#include "BasicsC/files.h"
#include "BasicsC/json.h"
#include "BasicsC/json-utilities.h"
#include "BasicsC/logging.h"
#include "BasicsC/tri-strings.h"
#include "CapConstraint/cap-constraint.h"
#include "FulltextIndex/fulltext-index.h"
#include "HttpServer/ApplicationEndpointServer.h"
#include "Replication/InitialSyncer.h"
#include "Rest/SslInterface.h"
#include "ShapedJson/shape-accessor.h"
#include "ShapedJson/shaped-json.h"
#include "Utils/AhuacatlGuard.h"
#include "Utils/AhuacatlTransaction.h"
#include "Utils/DocumentHelper.h"
#include "Utils/transactions.h"
#include "Utils/V8ResolverGuard.h"
#include "V8/v8-conv.h"
#include "V8/v8-execution.h"
#include "V8/v8-utils.h"
#include "Wal/LogfileManager.h"
#include "VocBase/auth.h"
#include "VocBase/datafile.h"
#include "VocBase/document-collection.h"
#include "VocBase/edge-collection.h"
#include "VocBase/general-cursor.h"
#include "VocBase/key-generator.h"
#include "VocBase/replication-applier.h"
#include "VocBase/replication-dump.h"
#include "VocBase/server.h"
#include "VocBase/voc-shaper.h"
#include "VocBase/index.h"
#include "v8.h"
#include "V8/JSLoader.h"
#include "Basics/JsonHelper.h"
#include "Cluster/AgencyComm.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ClusterInfo.h"
#include "Cluster/ClusterMethods.h"
#include "Cluster/ServerState.h"
#include "Aql/ExecutionBlock.h"
#include "unicode/timezone.h"
#include "unicode/utypes.h"
#include "unicode/datefmt.h"
#include "unicode/smpdtfmt.h"
#include "unicode/dtfmtsym.h"
#include "v8-vocbaseprivate.h"
#include "v8-voccursor.h"
using namespace std;
using namespace triagens::basics;

View File

@ -30,6 +30,10 @@
#ifndef ARANGODB_V8SERVER_V8__CURSOR_H
#define ARANGODB_V8SERVER_V8__CURSOR_H 1
#include "Basics/Common.h"
#include "v8-vocbase.h"
#include "Ahuacatl/ahuacatl-context.h"
////////////////////////////////////////////////////////////////////////////////
/// @brief function that encapsulates execution of an AQL query
////////////////////////////////////////////////////////////////////////////////

View File

@ -27,73 +27,17 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "v8-vocbase.h"
#include "Ahuacatl/ahuacatl-codegen.h"
#include "Ahuacatl/ahuacatl-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.h"
#include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/Query.h"
#include "Basics/StringUtils.h"
#include "Basics/Utf8Helper.h"
#include "BasicsC/conversions.h"
#include "BasicsC/files.h"
#include "BasicsC/json.h"
#include "BasicsC/json-utilities.h"
#include "BasicsC/logging.h"
#include "BasicsC/tri-strings.h"
#include "CapConstraint/cap-constraint.h"
#include "FulltextIndex/fulltext-index.h"
#include "HttpServer/ApplicationEndpointServer.h"
#include "Replication/InitialSyncer.h"
#include "Rest/SslInterface.h"
#include "ShapedJson/shape-accessor.h"
#include "ShapedJson/shaped-json.h"
#include "Utils/AhuacatlGuard.h"
#include "Utils/AhuacatlTransaction.h"
#include "Utils/DocumentHelper.h"
#include "Utils/transactions.h"
#include "Utils/V8ResolverGuard.h"
#include "V8/v8-conv.h"
#include "V8/v8-execution.h"
#include "V8/v8-utils.h"
#include "Wal/LogfileManager.h"
#include "VocBase/auth.h"
#include "VocBase/datafile.h"
#include "VocBase/document-collection.h"
#include "VocBase/edge-collection.h"
#include "VocBase/general-cursor.h"
#include "VocBase/key-generator.h"
#include "VocBase/replication-applier.h"
#include "VocBase/replication-dump.h"
#include "VocBase/server.h"
#include "VocBase/voc-shaper.h"
#include "VocBase/index.h"
#include "v8.h"
#include "V8/JSLoader.h"
#include "Basics/JsonHelper.h"
#include "Cluster/AgencyComm.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ClusterInfo.h"
#include "Cluster/ClusterMethods.h"
#include "Cluster/ServerState.h"
#include "unicode/timezone.h"
#include "unicode/utypes.h"
#include "unicode/datefmt.h"
#include "unicode/smpdtfmt.h"
#include "unicode/dtfmtsym.h"
#include "v8-vocindex.h"
#include "v8-vocbase.h"
#include "v8-vocbaseprivate.h"
#include "v8-vocindex.h"
#include "v8-collection.h"
#include "Aql/ExecutionBlock.h"
#include "BasicsC/conversions.h"
#include "CapConstraint/cap-constraint.h"
#include "Utils/AhuacatlGuard.h"
#include "V8/v8-utils.h"
using namespace std;
using namespace triagens::basics;
using namespace triagens::arango;

View File

@ -30,6 +30,12 @@
#ifndef ARANGODB_V8SERVER_V8__INDEX_H
#define ARANGODB_V8SERVER_V8__INDEX_H 1
#include "Basics/Common.h"
#include "V8/v8-globals.h"
#include "VocBase/index.h"
#include "Utils/CollectionNameResolver.h"
////////////////////////////////////////////////////////////////////////////////
/// @brief looks up a index identifier
////////////////////////////////////////////////////////////////////////////////

View File

@ -27,70 +27,12 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "v8-vocbase.h"
#include "Ahuacatl/ahuacatl-codegen.h"
#include "Ahuacatl/ahuacatl-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.h"
#include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/Query.h"
#include "Basics/StringUtils.h"
#include "Basics/Utf8Helper.h"
#include "BasicsC/conversions.h"
#include "BasicsC/files.h"
#include "BasicsC/json.h"
#include "BasicsC/json-utilities.h"
#include "BasicsC/logging.h"
#include "BasicsC/tri-strings.h"
#include "CapConstraint/cap-constraint.h"
#include "FulltextIndex/fulltext-index.h"
#include "HttpServer/ApplicationEndpointServer.h"
#include "Replication/InitialSyncer.h"
#include "Rest/SslInterface.h"
#include "ShapedJson/shape-accessor.h"
#include "ShapedJson/shaped-json.h"
#include "Utils/AhuacatlGuard.h"
#include "Utils/AhuacatlTransaction.h"
#include "Utils/DocumentHelper.h"
#include "Utils/transactions.h"
#include "Utils/V8ResolverGuard.h"
#include "V8/v8-conv.h"
#include "V8/v8-execution.h"
#include "V8/v8-utils.h"
#include "Wal/LogfileManager.h"
#include "VocBase/auth.h"
#include "VocBase/datafile.h"
#include "VocBase/document-collection.h"
#include "VocBase/edge-collection.h"
#include "VocBase/general-cursor.h"
#include "VocBase/key-generator.h"
#include "VocBase/replication-applier.h"
#include "VocBase/replication-dump.h"
#include "VocBase/server.h"
#include "VocBase/voc-shaper.h"
#include "VocBase/index.h"
#include "v8.h"
#include "V8/JSLoader.h"
#include "Basics/JsonHelper.h"
#include "Cluster/AgencyComm.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ClusterInfo.h"
#include "Cluster/ClusterMethods.h"
#include "Cluster/ServerState.h"
#include "unicode/timezone.h"
#include "unicode/utypes.h"
#include "unicode/datefmt.h"
#include "unicode/smpdtfmt.h"
#include "unicode/dtfmtsym.h"
#include "v8-wrapshapedjson.h"
#include "v8-vocbaseprivate.h"
#include "Aql/ExecutionBlock.h"
#include "BasicsC/conversions.h"
using namespace std;
using namespace triagens::basics;
using namespace triagens::arango;

View File

@ -30,6 +30,9 @@
#ifndef ARANGODB_V8SERVER_V8__WRAPSHAPEDJSON_H
#define ARANGODB_V8SERVER_V8__WRAPSHAPEDJSON_H
#include "Basics/Common.h"
#include "v8-vocbase.h"
////////////////////////////////////////////////////////////////////////////////
/// @brief wraps a TRI_shaped_json_t
////////////////////////////////////////////////////////////////////////////////