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 () { 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; return TRI_ERROR_NO_ERROR;
} }
@ -51,10 +58,8 @@ void ExecutionBlock::walk (WalkerWorker* worker) {
worker->before(this); worker->before(this);
// Now the children in their natural order: // Now the children in their natural order:
for (auto it = _dependencies.begin(); for (auto c : _dependencies) {
it != _dependencies.end(); c->walk(worker);
++it) {
(*it)->walk(worker);
} }
// Now handle a subquery: // Now handle a subquery:
if (_exeNode->getType() == ExecutionNode::SUBQUERY) { if (_exeNode->getType() == ExecutionNode::SUBQUERY) {

View File

@ -191,10 +191,10 @@ namespace triagens {
// Copy constructor used for a subquery: // Copy constructor used for a subquery:
VarOverview (VarOverview const& v) 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) { depth(v.depth+1), totalNrRegs(v.totalNrRegs), me(nullptr) {
nrRegsHere.push_back(0); nrRegsHere.push_back(0);
nrRegs.push_back(0); nrRegs.push_back(nrRegs.back());
} }
~VarOverview () {}; ~VarOverview () {};
@ -294,11 +294,6 @@ namespace triagens {
v->setSharedPtr(&v); v->setSharedPtr(&v);
walk(v.get()); walk(v.get());
v->reset(); 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 /// @brief bind
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual int bind (std::map<std::string, struct TRI_json_s*>* params); virtual int bind (AqlItemBlock* items, size_t pos);
////////////////////////////////////////////////////////////////////////////////
/// @brief getParameters
////////////////////////////////////////////////////////////////////////////////
std::map<std::string, struct TRI_json_s*>* getParameters ();
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief execute /// @brief execute
@ -400,34 +389,7 @@ namespace triagens {
public: public:
virtual AqlItemBlock* getOne () { virtual AqlItemBlock* getOne () {
if (_done) { return getSome (1, 1);
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;
} }
virtual AqlItemBlock* getSome (size_t atLeast, virtual AqlItemBlock* getSome (size_t atLeast,
@ -645,7 +607,7 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
SingletonBlock (AQL_TRANSACTION_V8* trx, SingletonNode const* ep) SingletonBlock (AQL_TRANSACTION_V8* trx, SingletonNode const* ep)
: ExecutionBlock(trx, ep) { : ExecutionBlock(trx, ep), _inputRegisterValues(nullptr) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -660,9 +622,23 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int initialize () { int initialize () {
_inputRegisterValues = nullptr; // just in case
return ExecutionBlock::initialize(); 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 /// @brief execute, just call base class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -676,20 +652,11 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int shutdown () { int shutdown () {
return ExecutionBlock::shutdown(); int res = ExecutionBlock::shutdown();
if (_inputRegisterValues != nullptr) {
delete _inputRegisterValues;
_inputRegisterValues = nullptr;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief getOne
////////////////////////////////////////////////////////////////////////////////
AqlItemBlock* getOne () {
if (_done) {
return nullptr;
}
AqlItemBlock* res(new AqlItemBlock(1, _varOverview->nrRegs[_depth]));
_done = true;
return res; return res;
} }
@ -697,12 +664,21 @@ namespace triagens {
/// @brief getSome /// @brief getSome
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
AqlItemBlock* getSome (size_t atLeast, size_t atMost) { AqlItemBlock* getSome (size_t, size_t) {
if (_done) { if (_done) {
return nullptr; 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; _done = true;
return res; return res;
} }
@ -745,6 +721,14 @@ namespace triagens {
return _done ? 0 : 1; return _done ? 0 : 1;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief the bind data coming from outside
////////////////////////////////////////////////////////////////////////////////
private:
AqlItemBlock* _inputRegisterValues;
}; };
@ -875,60 +859,6 @@ namespace triagens {
return res; 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 /// @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 /// @brief getSome
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1491,41 +1398,6 @@ namespace triagens {
return true; 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 /// @brief getSome
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1884,44 +1756,6 @@ namespace triagens {
return TRI_ERROR_NO_ERROR; 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 /// @brief getSome
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -2014,32 +1848,6 @@ namespace triagens {
~ReturnBlock () { ~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 /// @brief getSome
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -68,7 +68,7 @@ namespace triagens {
CALCULATION, // done CALCULATION, // done
SUBQUERY, // done SUBQUERY, // done
SORT, // done SORT, // done
AGGREGATE, // todo AGGREGATE, // done
LOOKUP_JOIN, LOOKUP_JOIN,
MERGE_JOIN, MERGE_JOIN,
LOOKUP_INDEX_UNIQUE, LOOKUP_INDEX_UNIQUE,
@ -1025,6 +1025,7 @@ namespace triagens {
AggregateNode (std::vector<std::pair<Variable const*, Variable const*>> aggregateVariables, AggregateNode (std::vector<std::pair<Variable const*, Variable const*>> aggregateVariables,
Variable const* outVariable) Variable const* outVariable)
: ExecutionNode(), _aggregateVariables(aggregateVariables), _outVariable(outVariable) { : ExecutionNode(), _aggregateVariables(aggregateVariables), _outVariable(outVariable) {
// outVariable can be a nullptr
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1068,7 +1069,7 @@ namespace triagens {
private: 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; 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 /// @file
/// ///
@ -43,18 +43,19 @@ namespace triagens {
Function () = delete; Function () = delete;
Function (std::string const& name, ////////////////////////////////////////////////////////////////////////////////
std::string const& arguments, /// @brief create the function
bool isDeterministic) ////////////////////////////////////////////////////////////////////////////////
: name(name),
arguments(arguments),
isDeterministic(isDeterministic) {
initArguments(); Function (std::string const&,
} std::string const&,
bool);
~Function () { ////////////////////////////////////////////////////////////////////////////////
} /// @brief destroy the function
////////////////////////////////////////////////////////////////////////////////
~Function ();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
@ -77,66 +78,19 @@ namespace triagens {
return std::make_pair(minRequiredArguments, maxRequiredArguments); 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 /// @brief parse the argument list and set the minimum and maximum number of
/// arguments /// arguments
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void initArguments () { 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;
}
}
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public variables // --SECTION-- public variables
@ -161,6 +115,13 @@ namespace triagens {
bool const isDeterministic; 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 /// @brief minimum number of required arguments
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -404,6 +404,18 @@ void V8Executor::generateCodeExpression (AstNode const* node) {
_buffer->appendText("; })"); _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 /// @brief generate JavaScript code for a list
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -441,11 +453,12 @@ void V8Executor::generateCodeArray (AstNode const* node) {
auto member = node->getMember(i); auto member = node->getMember(i);
_buffer->appendText("\""); if (member != nullptr) {
_buffer->appendJsonEncoded(member->getStringValue()); generateCodeString(member->getStringValue());
_buffer->appendText("\" : "); _buffer->appendText(" : ");
generateCodeNode(member->getMember(0)); generateCodeNode(member->getMember(0));
} }
}
_buffer->appendText(" }"); _buffer->appendText(" }");
} }
@ -547,9 +560,9 @@ void V8Executor::generateCodeReference (AstNode const* node) {
auto variable = static_cast<Variable*>(node->getData()); auto variable = static_cast<Variable*>(node->getData());
_buffer->appendText("vars[\""); _buffer->appendText("vars[");
_buffer->appendJsonEncoded(variable->name.c_str()); generateCodeString(variable->name.c_str());
_buffer->appendText("\"]"); _buffer->appendText("]");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -562,9 +575,9 @@ void V8Executor::generateCodeVariable (AstNode const* node) {
auto variable = static_cast<Variable*>(node->getData()); auto variable = static_cast<Variable*>(node->getData());
_buffer->appendText("vars[\""); _buffer->appendText("vars[");
_buffer->appendJsonEncoded(variable->name.c_str()); generateCodeString(variable->name.c_str());
_buffer->appendText("\"]"); _buffer->appendText("]");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -577,9 +590,9 @@ void V8Executor::generateCodeCollection (AstNode const* node) {
char const* name = node->getStringValue(); char const* name = node->getStringValue();
_buffer->appendText("aql.GET_DOCUMENTS(\""); _buffer->appendText("aql.GET_DOCUMENTS(");
_buffer->appendJsonEncoded(name); generateCodeString(name);
_buffer->appendText("\")"); _buffer->appendText(")");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -606,8 +619,21 @@ void V8Executor::generateCodeFunctionCall (AstNode const* node) {
_buffer->appendText(", "); _buffer->appendText(", ");
} }
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)); generateCodeNode(args->getMember(i));
} }
}
}
_buffer->appendText(")"); _buffer->appendText(")");
} }
@ -626,9 +652,9 @@ void V8Executor::generateCodeUserFunctionCall (AstNode const* node) {
TRI_ASSERT(args != nullptr); TRI_ASSERT(args != nullptr);
TRI_ASSERT(args->type == NODE_TYPE_LIST); TRI_ASSERT(args->type == NODE_TYPE_LIST);
_buffer->appendText("aql.FCALL_USER(\""); _buffer->appendText("aql.FCALL_USER(");
_buffer->appendJsonEncoded(name); generateCodeString(name);
_buffer->appendText("\", ["); _buffer->appendText(", [");
size_t const n = args->numMembers(); size_t const n = args->numMembers();
for (size_t i = 0; i < n; ++i) { for (size_t i = 0; i < n; ++i) {
@ -693,9 +719,9 @@ void V8Executor::generateCodeNamedAccess (AstNode const* node) {
_buffer->appendText("aql.DOCUMENT_MEMBER("); _buffer->appendText("aql.DOCUMENT_MEMBER(");
generateCodeNode(node->getMember(0)); generateCodeNode(node->getMember(0));
_buffer->appendText(", \""); _buffer->appendText(", ");
_buffer->appendJsonEncoded(node->getStringValue()); generateCodeString(node->getStringValue());
_buffer->appendText("\")"); _buffer->appendText(")");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -114,6 +114,12 @@ namespace triagens {
void generateCodeExpression (AstNode const*); void generateCodeExpression (AstNode const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief generates code for a string value
////////////////////////////////////////////////////////////////////////////////
void generateCodeString (char const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief generate JavaScript code for a list /// @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 /// @file
/// ///
@ -31,10 +31,7 @@
#define ARANGODB_AQL_V8_EXPRESSION_H 1 #define ARANGODB_AQL_V8_EXPRESSION_H 1
#include "Basics/Common.h" #include "Basics/Common.h"
#include "Basics/JsonHelper.h"
#include "BasicsC/json.h"
#include "Aql/Types.h" #include "Aql/Types.h"
#include "V8/v8-conv.h"
#include <v8.h> #include <v8.h>
namespace triagens { namespace triagens {
@ -46,68 +43,41 @@ namespace triagens {
struct V8Expression { struct V8Expression {
// -----------------------------------------------------------------------------
// --SECTION-- constructors / destructors
// -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create the v8 expression /// @brief create the v8 expression
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
V8Expression (v8::Isolate* isolate, V8Expression (v8::Isolate*,
v8::Persistent<v8::Function> func) v8::Persistent<v8::Function>);
: isolate(isolate),
func(func) {
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief destroy the v8 expression /// @brief destroy the v8 expression
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
~V8Expression () { ~V8Expression ();
func.Dispose(isolate);
func.Clear(); // -----------------------------------------------------------------------------
} // --SECTION-- public methods
// -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief execute the expression /// @brief execute the expression
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
AqlValue execute (AQL_TRANSACTION_V8* trx, AqlValue execute (AQL_TRANSACTION_V8*,
std::vector<TRI_document_collection_t const*>& docColls, std::vector<TRI_document_collection_t const*>&,
std::vector<AqlValue>& argv, std::vector<AqlValue>&,
size_t startPos, size_t,
std::vector<Variable*> const& vars, std::vector<Variable*> const&,
std::vector<RegisterId> const& regs) { std::vector<RegisterId> const&);
// TODO: decide whether a separate handle scope is needed
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-- public variables
// -----------------------------------------------------------------------------
v8::Isolate* isolate; v8::Isolate* isolate;

View File

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

View File

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

View File

@ -27,72 +27,29 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany /// @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-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h" #include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.h"
#include "Aql/ExecutionBlock.h" #include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/Query.h" #include "Aql/Query.h"
#include "Basics/StringUtils.h"
#include "Basics/Utf8Helper.h" #include "Basics/Utf8Helper.h"
#include "BasicsC/conversions.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 "Utils/V8ResolverGuard.h"
#include "V8/v8-conv.h"
#include "V8/v8-execution.h"
#include "V8/v8-utils.h" #include "V8/v8-utils.h"
#include "Wal/LogfileManager.h" #include "Wal/LogfileManager.h"
#include "VocBase/auth.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/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/ClusterMethods.h"
#include "Cluster/ServerState.h"
#include "unicode/timezone.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-vocbase.h"
#include "v8-vocbaseprivate.h" #include "v8-vocbaseprivate.h"
#include "v8-vocindex.h" #include "v8-vocindex.h"
#include "v8-collection.h"
using namespace std; using namespace std;
using namespace triagens::basics; using namespace triagens::basics;

View File

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

View File

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

View File

@ -27,69 +27,15 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany /// @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-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.h"
#include "Aql/ExecutionBlock.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 "V8/v8-utils.h"
#include "Wal/LogfileManager.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/replication-dump.h"
#include "VocBase/server.h" #include "Replication/InitialSyncer.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"
using namespace std; using namespace std;
using namespace triagens::basics; using namespace triagens::basics;
@ -650,6 +596,7 @@ void TRI_InitV8replication (v8::Handle<v8::Context> context,
JSLoader* loader, JSLoader* loader,
const size_t threadNumber, const size_t threadNumber,
TRI_v8_global_t* v8g){ TRI_v8_global_t* v8g){
// replication functions. not intended to be used by end users // replication functions. not intended to be used by end users
TRI_AddGlobalFunctionVocbase(context, "REPLICATION_LOGGER_STATE", JS_StateLoggerReplication, true); TRI_AddGlobalFunctionVocbase(context, "REPLICATION_LOGGER_STATE", JS_StateLoggerReplication, true);
TRI_AddGlobalFunctionVocbase(context, "REPLICATION_LOGGER_CONFIGURE", JS_ConfigureLoggerReplication, 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_SHUTDOWN", JS_ShutdownApplierReplication, true);
TRI_AddGlobalFunctionVocbase(context, "REPLICATION_APPLIER_STATE", JS_StateApplierReplication, true); TRI_AddGlobalFunctionVocbase(context, "REPLICATION_APPLIER_STATE", JS_StateApplierReplication, true);
TRI_AddGlobalFunctionVocbase(context, "REPLICATION_APPLIER_FORGET", JS_ForgetApplierReplication, true); TRI_AddGlobalFunctionVocbase(context, "REPLICATION_APPLIER_FORGET", JS_ForgetApplierReplication, true);
} }

View File

@ -27,67 +27,10 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany /// @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-vocbaseprivate.h"
#include "v8-wrapshapedjson.h" #include "Aql/ExecutionBlock.h"
#include "v8-voccursor.h" #include "BasicsC/conversions.h"
#include "VocBase/key-generator.h"
using namespace std; using namespace std;
using namespace triagens::basics; using namespace triagens::basics;

View File

@ -27,52 +27,29 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany /// @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-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h" #include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.h"
#include "Aql/ExecutionBlock.h" #include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionNode.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/Query.h" #include "Aql/Query.h"
#include "Basics/StringUtils.h"
#include "Basics/Utf8Helper.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 "HttpServer/ApplicationEndpointServer.h"
#include "Rest/SslInterface.h"
#include "ShapedJson/shape-accessor.h"
#include "ShapedJson/shaped-json.h"
#include "Utils/AhuacatlGuard.h" #include "Utils/AhuacatlGuard.h"
#include "Utils/AhuacatlTransaction.h" #include "Utils/AhuacatlTransaction.h"
#include "Utils/DocumentHelper.h"
#include "Utils/transactions.h"
#include "Utils/V8ResolverGuard.h" #include "Utils/V8ResolverGuard.h"
#include "V8/v8-conv.h" #include "V8/v8-conv.h"
#include "V8/v8-execution.h" #include "V8/v8-execution.h"
#include "V8/v8-utils.h" #include "V8/v8-utils.h"
#include "Wal/LogfileManager.h" #include "Wal/LogfileManager.h"
#include "VocBase/auth.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.h"
#include "V8/JSLoader.h" #include "V8/JSLoader.h"
#include "Basics/JsonHelper.h"
#include "Cluster/AgencyComm.h" #include "Cluster/AgencyComm.h"
#include "Cluster/ClusterComm.h" #include "Cluster/ClusterComm.h"
#include "Cluster/ClusterInfo.h" #include "Cluster/ClusterInfo.h"
@ -80,15 +57,9 @@
#include "Cluster/ServerState.h" #include "Cluster/ServerState.h"
#include "unicode/timezone.h" #include "unicode/timezone.h"
#include "unicode/utypes.h"
#include "unicode/datefmt.h"
#include "unicode/smpdtfmt.h" #include "unicode/smpdtfmt.h"
#include "unicode/dtfmtsym.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 std;
using namespace triagens::basics; using namespace triagens::basics;

View File

@ -30,6 +30,12 @@
#ifndef ARANGODB_V8SERVER_V8__VOCBASE_PRIVATE_H #ifndef ARANGODB_V8SERVER_V8__VOCBASE_PRIVATE_H
#define 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 /// @brief wrapped class for TRI_vocbase_t
/// ///

View File

@ -27,70 +27,17 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany /// @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-codegen.h"
#include "Ahuacatl/ahuacatl-collections.h" #include "Ahuacatl/ahuacatl-collections.h"
#include "Ahuacatl/ahuacatl-context.h"
#include "Ahuacatl/ahuacatl-explain.h"
#include "Ahuacatl/ahuacatl-result.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/AhuacatlTransaction.h"
#include "Utils/DocumentHelper.h" #include "Aql/ExecutionBlock.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 "v8-voccursor.h"
using namespace std; using namespace std;
using namespace triagens::basics; using namespace triagens::basics;

View File

@ -30,6 +30,10 @@
#ifndef ARANGODB_V8SERVER_V8__CURSOR_H #ifndef ARANGODB_V8SERVER_V8__CURSOR_H
#define ARANGODB_V8SERVER_V8__CURSOR_H 1 #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 /// @brief function that encapsulates execution of an AQL query
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -27,73 +27,17 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "v8-vocbase.h" #include "v8-vocindex.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-vocbase.h"
#include "v8-vocbaseprivate.h" #include "v8-vocbaseprivate.h"
#include "v8-vocindex.h"
#include "v8-collection.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 std;
using namespace triagens::basics; using namespace triagens::basics;
using namespace triagens::arango; using namespace triagens::arango;

View File

@ -30,6 +30,12 @@
#ifndef ARANGODB_V8SERVER_V8__INDEX_H #ifndef ARANGODB_V8SERVER_V8__INDEX_H
#define ARANGODB_V8SERVER_V8__INDEX_H 1 #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 /// @brief looks up a index identifier
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -27,70 +27,12 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "v8-vocbase.h" #include "v8-wrapshapedjson.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 "v8-vocbaseprivate.h"
#include "Aql/ExecutionBlock.h"
#include "BasicsC/conversions.h"
using namespace std; using namespace std;
using namespace triagens::basics; using namespace triagens::basics;
using namespace triagens::arango; using namespace triagens::arango;

View File

@ -30,6 +30,9 @@
#ifndef ARANGODB_V8SERVER_V8__WRAPSHAPEDJSON_H #ifndef ARANGODB_V8SERVER_V8__WRAPSHAPEDJSON_H
#define 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 /// @brief wraps a TRI_shaped_json_t
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////