mirror of https://gitee.com/bigwinds/arangodb
Snapshot.
This commit is contained in:
parent
fdba62a957
commit
786ea250ba
|
@ -282,7 +282,7 @@ static bool InsertOrs (TRI_aql_context_t* const context,
|
|||
orElement = FindOrElement(dest, fieldAccess->_fullName);
|
||||
if (orElement == NULL) {
|
||||
// element not found. create a new one
|
||||
orElement = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(or_element_t), false);
|
||||
orElement = static_cast<or_element_t*>(TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(or_element_t), false));
|
||||
if (orElement == NULL) {
|
||||
// out of memory
|
||||
return false;
|
||||
|
@ -2061,7 +2061,7 @@ static TRI_vector_pointer_t* MergeVectors (TRI_aql_context_t* const context,
|
|||
// this is an OR merge
|
||||
// we need to check which elements are contained in just one of the vectors and
|
||||
// remove them. if we don't do this, we would probably restrict the query too much
|
||||
orElements = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_vector_pointer_t), false);
|
||||
orElements = static_cast<TRI_vector_pointer_t*>(TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_vector_pointer_t), false));
|
||||
if (orElements == NULL) {
|
||||
TRI_SetErrorContextAql(__FILE__, __LINE__, context, TRI_ERROR_OUT_OF_MEMORY, NULL);
|
||||
|
||||
|
@ -2159,7 +2159,7 @@ static TRI_vector_pointer_t* MergeVectors (TRI_aql_context_t* const context,
|
|||
|
||||
static TRI_aql_field_access_t* CreateAccessForNode (TRI_aql_context_t* const context,
|
||||
const TRI_aql_attribute_name_t* const field,
|
||||
const TRI_aql_node_type_e operator,
|
||||
const TRI_aql_node_type_e operatorarg,
|
||||
const TRI_aql_node_t* const node) {
|
||||
TRI_aql_field_access_t* fieldAccess;
|
||||
TRI_json_t* value;
|
||||
|
@ -2189,7 +2189,7 @@ static TRI_aql_field_access_t* CreateAccessForNode (TRI_aql_context_t* const con
|
|||
|
||||
SetNameLength(fieldAccess);
|
||||
|
||||
if (operator == TRI_AQL_NODE_OPERATOR_BINARY_NE) {
|
||||
if (operatorarg == TRI_AQL_NODE_OPERATOR_BINARY_NE) {
|
||||
// create an all items access, and we're done
|
||||
fieldAccess->_type = TRI_AQL_ACCESS_ALL;
|
||||
|
||||
|
@ -2200,7 +2200,7 @@ static TRI_aql_field_access_t* CreateAccessForNode (TRI_aql_context_t* const con
|
|||
node->_type == TRI_AQL_NODE_ATTRIBUTE_ACCESS) {
|
||||
// create the reference access
|
||||
fieldAccess->_type = TRI_AQL_ACCESS_REFERENCE;
|
||||
fieldAccess->_value._reference._operator = operator;
|
||||
fieldAccess->_value._reference._operator = operatorarg;
|
||||
|
||||
if (node->_type == TRI_AQL_NODE_REFERENCE) {
|
||||
fieldAccess->_value._reference._type = TRI_AQL_REFERENCE_VARIABLE;
|
||||
|
@ -2225,36 +2225,36 @@ static TRI_aql_field_access_t* CreateAccessForNode (TRI_aql_context_t* const con
|
|||
|
||||
assert(value != NULL);
|
||||
|
||||
if (operator == TRI_AQL_NODE_OPERATOR_BINARY_EQ) {
|
||||
if (operatorarg == TRI_AQL_NODE_OPERATOR_BINARY_EQ) {
|
||||
// create an exact value access
|
||||
fieldAccess->_type = TRI_AQL_ACCESS_EXACT;
|
||||
fieldAccess->_value._value = value;
|
||||
}
|
||||
else if (operator == TRI_AQL_NODE_OPERATOR_BINARY_LT) {
|
||||
else if (operatorarg == TRI_AQL_NODE_OPERATOR_BINARY_LT) {
|
||||
// create a single range access
|
||||
fieldAccess->_type = TRI_AQL_ACCESS_RANGE_SINGLE;
|
||||
fieldAccess->_value._singleRange._type = TRI_AQL_RANGE_UPPER_EXCLUDED;
|
||||
fieldAccess->_value._singleRange._value = value;
|
||||
}
|
||||
else if (operator == TRI_AQL_NODE_OPERATOR_BINARY_LE) {
|
||||
else if (operatorarg == TRI_AQL_NODE_OPERATOR_BINARY_LE) {
|
||||
// create a single range access
|
||||
fieldAccess->_type = TRI_AQL_ACCESS_RANGE_SINGLE;
|
||||
fieldAccess->_value._singleRange._type = TRI_AQL_RANGE_UPPER_INCLUDED;
|
||||
fieldAccess->_value._singleRange._value = value;
|
||||
}
|
||||
else if (operator == TRI_AQL_NODE_OPERATOR_BINARY_GT) {
|
||||
else if (operatorarg == TRI_AQL_NODE_OPERATOR_BINARY_GT) {
|
||||
// create a single range access
|
||||
fieldAccess->_type = TRI_AQL_ACCESS_RANGE_SINGLE;
|
||||
fieldAccess->_value._singleRange._type = TRI_AQL_RANGE_LOWER_EXCLUDED;
|
||||
fieldAccess->_value._singleRange._value = value;
|
||||
}
|
||||
else if (operator == TRI_AQL_NODE_OPERATOR_BINARY_GE) {
|
||||
else if (operatorarg == TRI_AQL_NODE_OPERATOR_BINARY_GE) {
|
||||
// create a single range access
|
||||
fieldAccess->_type = TRI_AQL_ACCESS_RANGE_SINGLE;
|
||||
fieldAccess->_value._singleRange._type = TRI_AQL_RANGE_LOWER_INCLUDED;
|
||||
fieldAccess->_value._singleRange._value = value;
|
||||
}
|
||||
else if (operator == TRI_AQL_NODE_OPERATOR_BINARY_IN) {
|
||||
else if (operatorarg == TRI_AQL_NODE_OPERATOR_BINARY_IN) {
|
||||
TRI_json_t* list;
|
||||
|
||||
if (value->_type != TRI_JSON_LIST) {
|
||||
|
@ -2301,7 +2301,7 @@ static TRI_aql_field_access_t* CreateAccessForNode (TRI_aql_context_t* const con
|
|||
|
||||
static TRI_aql_field_access_t* GetAttributeAccess (TRI_aql_context_t* const context,
|
||||
const TRI_aql_attribute_name_t* const field,
|
||||
const TRI_aql_node_type_e operator,
|
||||
const TRI_aql_node_type_e operatorarg,
|
||||
const TRI_aql_node_t* const node) {
|
||||
TRI_aql_field_access_t* fieldAccess;
|
||||
|
||||
|
@ -2313,7 +2313,7 @@ static TRI_aql_field_access_t* GetAttributeAccess (TRI_aql_context_t* const cont
|
|||
return NULL;
|
||||
}
|
||||
|
||||
fieldAccess = CreateAccessForNode(context, field, operator, node);
|
||||
fieldAccess = CreateAccessForNode(context, field, operatorarg, node);
|
||||
|
||||
if (fieldAccess == NULL) {
|
||||
// OOM
|
||||
|
@ -2486,7 +2486,7 @@ static TRI_vector_pointer_t* ProcessNode (TRI_aql_context_t* const context,
|
|||
TRI_aql_attribute_name_t* field;
|
||||
TRI_aql_node_t* node1;
|
||||
TRI_aql_node_t* node2;
|
||||
TRI_aql_node_type_e operator;
|
||||
TRI_aql_node_type_e oper;
|
||||
bool useBoth;
|
||||
|
||||
/*
|
||||
|
@ -2502,7 +2502,7 @@ static TRI_vector_pointer_t* ProcessNode (TRI_aql_context_t* const context,
|
|||
// collection.attribute|reference|fcall operator const value|reference|attribute access|fcall
|
||||
node1 = lhs;
|
||||
node2 = rhs;
|
||||
operator = node->_type;
|
||||
oper = node->_type;
|
||||
|
||||
if (IsSameAttributeAccess(lhs, rhs)) {
|
||||
// we must not optimise something like FILTER a.x == a.x
|
||||
|
@ -2520,7 +2520,7 @@ static TRI_vector_pointer_t* ProcessNode (TRI_aql_context_t* const context,
|
|||
// const value|reference|attribute|fcall access operator collection.attribute|reference|fcall
|
||||
node1 = rhs;
|
||||
node2 = lhs;
|
||||
operator = TRI_ReverseOperatorRelationalAql(node->_type);
|
||||
oper = TRI_ReverseOperatorRelationalAql(node->_type);
|
||||
|
||||
if (IsSameAttributeAccess(lhs, rhs)) {
|
||||
// we must not optimise something like FILTER a.x == a.x
|
||||
|
@ -2528,7 +2528,7 @@ static TRI_vector_pointer_t* ProcessNode (TRI_aql_context_t* const context,
|
|||
}
|
||||
|
||||
|
||||
TRI_ASSERT_MAINTAINER(operator != TRI_AQL_NODE_NOP);
|
||||
TRI_ASSERT_MAINTAINER(oper != TRI_AQL_NODE_NOP);
|
||||
|
||||
if (lhs->_type == TRI_AQL_NODE_REFERENCE || lhs->_type == TRI_AQL_NODE_ATTRIBUTE_ACCESS || lhs->_type == TRI_AQL_NODE_FCALL) {
|
||||
// expression of type reference|attribute access|fcall operator reference|attribute access|fcall
|
||||
|
@ -2555,7 +2555,7 @@ again:
|
|||
field = GetAttributeName(context, node1);
|
||||
|
||||
if (field && node2->_type != TRI_AQL_NODE_FCALL) {
|
||||
TRI_aql_field_access_t* attributeAccess = GetAttributeAccess(context, field, operator, node2);
|
||||
TRI_aql_field_access_t* attributeAccess = GetAttributeAccess(context, field, oper, node2);
|
||||
TRI_vector_pointer_t* result;
|
||||
|
||||
TRI_DestroyStringBuffer(&field->_name);
|
||||
|
@ -2592,7 +2592,7 @@ again:
|
|||
node1 = node2;
|
||||
node2 = tempNode;
|
||||
|
||||
operator = TRI_ReverseOperatorRelationalAql(node->_type);
|
||||
oper = TRI_ReverseOperatorRelationalAql(node->_type);
|
||||
|
||||
// and try again
|
||||
previous = result;
|
||||
|
|
|
@ -1063,7 +1063,8 @@ TRI_aql_node_t* TRI_CreateNodeFcallAql (TRI_aql_context_t* const context,
|
|||
|
||||
bool TRI_PushListAql (TRI_aql_context_t* const context,
|
||||
const TRI_aql_node_t* const value) {
|
||||
TRI_aql_node_t* node = TRI_PeekStackParseAql(context);
|
||||
TRI_aql_node_t* node
|
||||
= static_cast<TRI_aql_node_t*>(TRI_PeekStackParseAql(context));
|
||||
|
||||
assert(node);
|
||||
|
||||
|
@ -1083,7 +1084,8 @@ bool TRI_PushListAql (TRI_aql_context_t* const context,
|
|||
bool TRI_PushArrayAql (TRI_aql_context_t* const context,
|
||||
const char* const name,
|
||||
const TRI_aql_node_t* const value) {
|
||||
TRI_aql_node_t* node = TRI_PeekStackParseAql(context);
|
||||
TRI_aql_node_t* node
|
||||
= static_cast<TRI_aql_node_t*>(TRI_PeekStackParseAql(context));
|
||||
TRI_aql_node_t* element;
|
||||
|
||||
assert(node);
|
||||
|
|
|
@ -221,7 +221,7 @@ bool TRI_EqualBindParameterAql (TRI_associative_pointer_t* array,
|
|||
void const* element) {
|
||||
TRI_aql_bind_parameter_t* parameter = (TRI_aql_bind_parameter_t*) element;
|
||||
|
||||
return TRI_EqualString(key, parameter->_name);
|
||||
return TRI_EqualString(static_cast<char const*>(key), parameter->_name);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -281,8 +281,11 @@ bool TRI_AddParameterValuesAql (TRI_aql_context_t* const context,
|
|||
}
|
||||
|
||||
for (i = 0; i < n; i += 2) {
|
||||
TRI_json_t* name = TRI_AtVector(¶meters->_value._objects, i);
|
||||
TRI_json_t* value = TRI_AtVector(¶meters->_value._objects, i + 1);
|
||||
TRI_json_t* name
|
||||
= static_cast<TRI_json_t*>(TRI_AtVector(¶meters->_value._objects, i));
|
||||
TRI_json_t* value
|
||||
= static_cast<TRI_json_t*>(TRI_AtVector(¶meters->_value._objects,
|
||||
i + 1));
|
||||
TRI_aql_bind_parameter_t* parameter;
|
||||
|
||||
assert(TRI_IsStringJson(name));
|
||||
|
|
|
@ -232,7 +232,7 @@ static bool EqualVariable (TRI_associative_pointer_t* array,
|
|||
void const* element) {
|
||||
TRI_aql_codegen_variable_t* variable = (TRI_aql_codegen_variable_t*) element;
|
||||
|
||||
return TRI_EqualString(key, variable->_name);
|
||||
return TRI_EqualString(static_cast<char const*>(key), variable->_name);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2289,7 +2289,8 @@ static void ProcessFor (TRI_aql_codegen_js_t* const generator,
|
|||
TRI_aql_node_t* nameNode = TRI_AQL_NODE_MEMBER(node, 0);
|
||||
TRI_aql_node_t* expressionNode = TRI_AQL_NODE_MEMBER(node, 1);
|
||||
TRI_aql_codegen_register_t sourceRegister = IncRegister(generator);
|
||||
TRI_aql_for_hint_t* hint = TRI_AQL_NODE_DATA(node);
|
||||
TRI_aql_for_hint_t* hint
|
||||
= static_cast<TRI_aql_for_hint_t*>(TRI_AQL_NODE_DATA(node));
|
||||
TRI_string_buffer_t* buffer;
|
||||
bool isList;
|
||||
|
||||
|
@ -2915,7 +2916,7 @@ static TRI_aql_codegen_register_t CreateCode (TRI_aql_codegen_js_t* generator) {
|
|||
for (i = 0; i < n; ++i) {
|
||||
TRI_aql_node_t* node;
|
||||
|
||||
node = TRI_AtVectorPointer(statements, i);
|
||||
node = static_cast<TRI_aql_node_t*>(TRI_AtVectorPointer(statements, i));
|
||||
ProcessNode(generator, node);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ typedef struct TRI_aql_codegen_scope_s {
|
|||
TRI_aql_codegen_register_t _limitRegister; // limit offset, limit
|
||||
TRI_aql_codegen_register_t _subqueryRegister;
|
||||
TRI_associative_pointer_t _variables; // list of variables in scope
|
||||
char* _prefix; // prefix for variable names, used in FUNCTION scopes only
|
||||
char const* _prefix; // prefix for variable names, used in FUNCTION scopes only
|
||||
TRI_aql_for_hint_t* _hint; // generic hint
|
||||
}
|
||||
TRI_aql_codegen_scope_t;
|
||||
|
|
|
@ -145,7 +145,7 @@ static bool SetupCollections (TRI_aql_context_t* const context) {
|
|||
n = context->_collectionNames._nrAlloc;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
char* name = context->_collectionNames._table[i];
|
||||
char* name = static_cast<char*>(context->_collectionNames._table[i]);
|
||||
TRI_aql_collection_t* collection;
|
||||
|
||||
if (name == NULL) {
|
||||
|
|
|
@ -179,7 +179,8 @@ char* TRI_GetContextErrorAql (const char* const query,
|
|||
return TRI_DuplicateString2Z(TRI_UNKNOWN_MEM_ZONE, query + offset, queryLength - offset);
|
||||
}
|
||||
|
||||
q = result = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, SNIPPET_LENGTH + strlen(SNIPPET_SUFFIX) + 1, false);
|
||||
q = result = static_cast<char*>(TRI_Allocate(TRI_UNKNOWN_MEM_ZONE,
|
||||
SNIPPET_LENGTH + strlen(SNIPPET_SUFFIX) + 1, false));
|
||||
|
||||
if (result == NULL) {
|
||||
// out of memory
|
||||
|
|
|
@ -128,7 +128,9 @@ static bool AddNodeValue (TRI_json_t* row, TRI_aql_node_t* const node) {
|
|||
}
|
||||
|
||||
if (node->_type == TRI_AQL_NODE_COLLECTION) {
|
||||
TRI_json_t* extra = TRI_GetJsonCollectionHintAql(TRI_AQL_NODE_DATA(node));
|
||||
TRI_json_t* extra = TRI_GetJsonCollectionHintAql(
|
||||
static_cast<TRI_aql_collection_hint_t*>
|
||||
(TRI_AQL_NODE_DATA(node)) );
|
||||
|
||||
if (extra != NULL) {
|
||||
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE,
|
||||
|
@ -326,7 +328,7 @@ static TRI_aql_node_t* ProcessStatement (TRI_aql_statement_walker_t* const walke
|
|||
"resultVariable",
|
||||
TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, TRI_AQL_NODE_STRING(variableNode)));
|
||||
|
||||
hint = TRI_AQL_NODE_DATA(node);
|
||||
hint = static_cast<TRI_aql_for_hint_t*>(TRI_AQL_NODE_DATA(node));
|
||||
if (hint != NULL &&
|
||||
hint->_limit._status == TRI_AQL_LIMIT_USE) {
|
||||
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE,
|
||||
|
|
|
@ -352,7 +352,8 @@ static bool EqualName (TRI_associative_pointer_t* array,
|
|||
void const* element) {
|
||||
TRI_aql_function_t* function = (TRI_aql_function_t*) element;
|
||||
|
||||
return TRI_EqualString(key, function->_externalName);
|
||||
return TRI_EqualString(static_cast<char const*>(key),
|
||||
function->_externalName);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -105,14 +105,14 @@ extern int Ahuacatldebug;
|
|||
typedef union YYSTYPE YYSTYPE;
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 26 "arangod/Ahuacatl/ahuacatl-grammar.y" /* yacc.c:1915 */
|
||||
#line 26 "arangod/Ahuacatl/ahuacatl-grammar.y" /* yacc.c:1909 */
|
||||
|
||||
TRI_aql_node_t* node;
|
||||
char* strval;
|
||||
bool boolval;
|
||||
int64_t intval;
|
||||
|
||||
#line 116 "arangod/Ahuacatl/ahuacatl-grammar.h" /* yacc.c:1915 */
|
||||
#line 116 "arangod/Ahuacatl/ahuacatl-grammar.h" /* yacc.c:1909 */
|
||||
};
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
%define api.pure
|
||||
%name-prefix="Ahuacatl"
|
||||
%name-prefix "Ahuacatl"
|
||||
%locations
|
||||
%defines
|
||||
%parse-param { TRI_aql_context_t* const context }
|
||||
|
|
|
@ -113,7 +113,8 @@ static TRI_aql_index_t* PickIndex (TRI_aql_context_t* const context,
|
|||
assert(fieldAccesses);
|
||||
|
||||
if (pickedIndex == NULL) {
|
||||
pickedIndex = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_aql_index_t), false);
|
||||
pickedIndex = static_cast<TRI_aql_index_t*>
|
||||
(TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_aql_index_t), false));
|
||||
|
||||
if (pickedIndex == NULL) {
|
||||
// OOM
|
||||
|
|
|
@ -533,7 +533,9 @@ static TRI_aql_node_t* AnnotateLoop (TRI_aql_statement_walker_t* const walker,
|
|||
assert(scope != NULL);
|
||||
|
||||
while (scope->_sorts._length > 0) {
|
||||
char* criterion = TRI_RemoveVectorPointer(&scope->_sorts, (size_t) (scope->_sorts._length - 1));
|
||||
char* criterion = static_cast<char*>
|
||||
(TRI_RemoveVectorPointer(&scope->_sorts,
|
||||
(size_t) (scope->_sorts._length - 1)));
|
||||
|
||||
if (criterion != NULL) {
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, criterion);
|
||||
|
@ -704,7 +706,7 @@ static TRI_aql_node_t* OptimiseFcall (TRI_aql_context_t* const context,
|
|||
return node;
|
||||
}
|
||||
|
||||
res = TRI_GetErrorExecutionContext(execContext);
|
||||
res = execContext->_error;
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_FreeExecutionContext(execContext);
|
||||
|
@ -714,7 +716,7 @@ static TRI_aql_node_t* OptimiseFcall (TRI_aql_context_t* const context,
|
|||
|
||||
json = TRI_ExecuteResultContext(execContext);
|
||||
|
||||
res = TRI_GetErrorExecutionContext(execContext);
|
||||
res = execContext->_error;
|
||||
TRI_FreeExecutionContext(execContext);
|
||||
|
||||
if (res == TRI_ERROR_REQUEST_CANCELED) {
|
||||
|
@ -1171,7 +1173,7 @@ static TRI_aql_node_t* OptimiseBinaryRelationalOperation (TRI_aql_context_t* con
|
|||
TRI_js_exec_context_t* execContext;
|
||||
TRI_string_buffer_t* code;
|
||||
TRI_json_t* json;
|
||||
char* func;
|
||||
char const* func;
|
||||
int res;
|
||||
|
||||
if (! lhs || ! TRI_IsConstantValueNodeAql(lhs) || ! rhs || ! TRI_IsConstantValueNodeAql(rhs)) {
|
||||
|
@ -1227,7 +1229,7 @@ static TRI_aql_node_t* OptimiseBinaryRelationalOperation (TRI_aql_context_t* con
|
|||
}
|
||||
|
||||
// check if an error occurred during context creation
|
||||
res = TRI_GetErrorExecutionContext(execContext);
|
||||
res = execContext->_error;
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_FreeExecutionContext(execContext);
|
||||
|
@ -1240,7 +1242,7 @@ static TRI_aql_node_t* OptimiseBinaryRelationalOperation (TRI_aql_context_t* con
|
|||
}
|
||||
|
||||
json = TRI_ExecuteResultContext(execContext);
|
||||
res = TRI_GetErrorExecutionContext(execContext);
|
||||
res = execContext->_error;
|
||||
|
||||
TRI_FreeExecutionContext(execContext);
|
||||
|
||||
|
@ -1564,7 +1566,9 @@ static void PatchVariables (TRI_aql_statement_walker_t* const walker) {
|
|||
if (expressionNode->_type == TRI_AQL_NODE_FCALL) {
|
||||
// the defining node is a function call
|
||||
// get the function name
|
||||
TRI_aql_function_t* function = TRI_AQL_NODE_DATA(expressionNode);
|
||||
TRI_aql_function_t* function
|
||||
= static_cast<TRI_aql_function_t*>
|
||||
(TRI_AQL_NODE_DATA(expressionNode));
|
||||
|
||||
if (function->optimise != NULL) {
|
||||
// call the function's optimise callback
|
||||
|
@ -1604,7 +1608,7 @@ static void NoteLimit (TRI_aql_statement_walker_t* const walker,
|
|||
TRI_aql_scope_t* scope;
|
||||
aql_optimiser_t* optimiser;
|
||||
|
||||
optimiser = walker->_data;
|
||||
optimiser = static_cast<aql_optimiser_t*>(walker->_data);
|
||||
|
||||
if (offset->_type != TRI_AQL_NODE_VALUE || limit->_type != TRI_AQL_NODE_VALUE) {
|
||||
TRI_SetErrorContextAql(__FILE__, __LINE__, optimiser->_context, TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, NULL);
|
||||
|
|
|
@ -157,7 +157,8 @@ static void FreeScope (TRI_aql_scope_t* const scope) {
|
|||
// free variables lookup hash
|
||||
n = scope->_variables._nrAlloc;
|
||||
for (i = 0; i < n; ++i) {
|
||||
TRI_aql_variable_t* variable = scope->_variables._table[i];
|
||||
TRI_aql_variable_t* variable
|
||||
= static_cast<TRI_aql_variable_t*>(scope->_variables._table[i]);
|
||||
|
||||
if (variable) {
|
||||
TRI_FreeVariableAql(variable);
|
||||
|
@ -340,7 +341,8 @@ bool TRI_EndScopeAql (TRI_aql_context_t* const context) {
|
|||
n = context->_currentScopes._length;
|
||||
assert(n > 0);
|
||||
|
||||
scope = TRI_RemoveVectorPointer(&context->_currentScopes, --n);
|
||||
scope = static_cast<TRI_aql_scope_t*>
|
||||
(TRI_RemoveVectorPointer(&context->_currentScopes, --n));
|
||||
LOG_TRACE("closing scope of type %s", TRI_TypeNameScopeAql(scope->_type));
|
||||
|
||||
node = TRI_CreateNodeScopeEndAql(context, scope);
|
||||
|
|
|
@ -134,7 +134,8 @@ static void RunWalk (TRI_aql_statement_walker_t* const walker) {
|
|||
if (walker->preVisitStatement != NULL) {
|
||||
// this might change the node ptr
|
||||
VisitStatement(walker, i, walker->preVisitStatement);
|
||||
node = walker->_statements->_statements._buffer[i];
|
||||
node = static_cast<TRI_aql_node_t*>
|
||||
(walker->_statements->_statements._buffer[i]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -330,7 +331,9 @@ TRI_aql_variable_t* TRI_GetVariableStatementWalkerAql (TRI_aql_statement_walker_
|
|||
scope = (TRI_aql_scope_t*) TRI_AtVectorPointer(&walker->_currentScopes, --n);
|
||||
assert(scope);
|
||||
|
||||
variable = TRI_LookupByKeyAssociativePointer(&scope->_variables, (void*) name);
|
||||
variable = static_cast<TRI_aql_variable_t*>
|
||||
(TRI_LookupByKeyAssociativePointer(&scope->_variables,
|
||||
(void*) name));
|
||||
if (variable != NULL) {
|
||||
return variable;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ bool TRI_EqualVariableAql (TRI_associative_pointer_t* array,
|
|||
void const* element) {
|
||||
TRI_aql_variable_t* variable = (TRI_aql_variable_t*) element;
|
||||
|
||||
return TRI_EqualString(key, variable->_name);
|
||||
return TRI_EqualString(static_cast<char const*>(key), variable->_name);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -163,16 +163,20 @@ FLEXXX_FILES += \
|
|||
### @brief bison
|
||||
################################################################################
|
||||
|
||||
BISONXX_FILES += \
|
||||
arangod/Ahuacatl/ahuacatl-grammar.cpp
|
||||
BISON_FILES += \
|
||||
arangod/Ahuacatl/ahuacatl-grammar.c
|
||||
|
||||
if ENABLE_MAINTAINER_MODE
|
||||
|
||||
CLEANUP += \
|
||||
arangod/Ahuacatl/ahuacatl-grammar.h \
|
||||
arangod/Ahuacatl/ahuacatl-grammar.c \
|
||||
arangod/Ahuacatl/ahuacatl-grammar.cpp
|
||||
endif
|
||||
|
||||
arangod/Ahuacatl/ahuacatl-grammar.cpp: arangod/Ahuacatl/ahuacatl-grammar.c
|
||||
cp arangod/Ahuacatl/ahuacatl-grammar.c arangod/Ahuacatl/ahuacatl-grammar.cpp
|
||||
|
||||
################################################################################
|
||||
## --SECTION-- END-OF-FILE
|
||||
################################################################################
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "VocBase/headers.h"
|
||||
#include "VocBase/index.h"
|
||||
#include "VocBase/voc-types.h"
|
||||
#include "Wal/Marker.h"
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
|
@ -146,39 +145,6 @@ struct TRI_json_s;
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief extracts the shaped JSON pointer from a marker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline void TRI_EXTRACT_SHAPED_JSON_MARKER (TRI_shaped_json_t& dst,
|
||||
void const* src) {
|
||||
if (((TRI_df_marker_t const*) (src))->_type == TRI_DOC_MARKER_KEY_DOCUMENT) {
|
||||
(dst)._sid = ((TRI_doc_document_key_marker_t*) (src))->_shape;
|
||||
(dst)._data.length = ((TRI_df_marker_t*) (src))->_size - ((TRI_doc_document_key_marker_t*) (src))->_offsetJson;
|
||||
(dst)._data.data = (((char*) (src)) + ((TRI_doc_document_key_marker_t*) (src))->_offsetJson);
|
||||
}
|
||||
else if (((TRI_df_marker_t const*) (src))->_type == TRI_DOC_MARKER_KEY_EDGE) {
|
||||
(dst)._sid = ((TRI_doc_document_key_marker_t*) (src))->_shape;
|
||||
(dst)._data.length = ((TRI_df_marker_t*) (src))->_size - ((TRI_doc_document_key_marker_t*) (src))->_offsetJson;
|
||||
(dst)._data.data = (((char*) (src)) + ((TRI_doc_document_key_marker_t*) (src))->_offsetJson);
|
||||
}
|
||||
else if (((TRI_df_marker_t const*) (src))->_type == TRI_WAL_MARKER_DOCUMENT) {
|
||||
(dst)._sid = ((triagens::wal::document_marker_t*) (src))->_shape;
|
||||
(dst)._data.length = ((TRI_df_marker_t*) (src))->_size - ((triagens::wal::document_marker_t*) (src))->_offsetJson;
|
||||
(dst)._data.data = (((char*) (src)) + ((triagens::wal::document_marker_t*) (src))->_offsetJson);
|
||||
}
|
||||
else if (((TRI_df_marker_t const*) (src))->_type == TRI_WAL_MARKER_EDGE) {
|
||||
(dst)._sid = ((triagens::wal::edge_marker_t*) (src))->base._shape;
|
||||
(dst)._data.length = ((TRI_df_marker_t*) (src))->_size - ((triagens::wal::edge_marker_t*) (src))->base._offsetJson;
|
||||
(dst)._data.data = (((char*) (src)) + ((triagens::wal::edge_marker_t*) (src))->base._offsetJson);
|
||||
}
|
||||
else {
|
||||
(dst)._sid = 0;
|
||||
(dst)._data.length = 0;
|
||||
(dst)._data.data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "VocBase/document-collection.h"
|
||||
#include "VocBase/transaction.h"
|
||||
#include "VocBase/vocbase.h"
|
||||
#include "VocBase/voc-shaper.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- REPLICATION
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "VocBase/server.h"
|
||||
#include "VocBase/transaction.h"
|
||||
#include "VocBase/vocbase.h"
|
||||
#include "VocBase/voc-shaper.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- REPLICATION LOGGER
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "ShapedJson/shaped-json.h"
|
||||
#include "VocBase/datafile.h"
|
||||
#include "VocBase/document-collection.h"
|
||||
#include "Wal/Marker.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -159,6 +160,39 @@ int TRI_CompareShapeTypes (TRI_doc_mptr_t* leftDocument,
|
|||
TRI_shaper_t* leftShaper,
|
||||
TRI_shaper_t* rightShaper);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief extracts the shaped JSON pointer from a marker
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline void TRI_EXTRACT_SHAPED_JSON_MARKER (TRI_shaped_json_t& dst,
|
||||
void const* src) {
|
||||
if (((TRI_df_marker_t const*) (src))->_type == TRI_DOC_MARKER_KEY_DOCUMENT) {
|
||||
(dst)._sid = ((TRI_doc_document_key_marker_t*) (src))->_shape;
|
||||
(dst)._data.length = ((TRI_df_marker_t*) (src))->_size - ((TRI_doc_document_key_marker_t*) (src))->_offsetJson;
|
||||
(dst)._data.data = (((char*) (src)) + ((TRI_doc_document_key_marker_t*) (src))->_offsetJson);
|
||||
}
|
||||
else if (((TRI_df_marker_t const*) (src))->_type == TRI_DOC_MARKER_KEY_EDGE) {
|
||||
(dst)._sid = ((TRI_doc_document_key_marker_t*) (src))->_shape;
|
||||
(dst)._data.length = ((TRI_df_marker_t*) (src))->_size - ((TRI_doc_document_key_marker_t*) (src))->_offsetJson;
|
||||
(dst)._data.data = (((char*) (src)) + ((TRI_doc_document_key_marker_t*) (src))->_offsetJson);
|
||||
}
|
||||
else if (((TRI_df_marker_t const*) (src))->_type == TRI_WAL_MARKER_DOCUMENT) {
|
||||
(dst)._sid = ((triagens::wal::document_marker_t*) (src))->_shape;
|
||||
(dst)._data.length = ((TRI_df_marker_t*) (src))->_size - ((triagens::wal::document_marker_t*) (src))->_offsetJson;
|
||||
(dst)._data.data = (((char*) (src)) + ((triagens::wal::document_marker_t*) (src))->_offsetJson);
|
||||
}
|
||||
else if (((TRI_df_marker_t const*) (src))->_type == TRI_WAL_MARKER_EDGE) {
|
||||
(dst)._sid = ((triagens::wal::edge_marker_t*) (src))->base._shape;
|
||||
(dst)._data.length = ((TRI_df_marker_t*) (src))->_size - ((triagens::wal::edge_marker_t*) (src))->base._offsetJson;
|
||||
(dst)._data.data = (((char*) (src)) + ((triagens::wal::edge_marker_t*) (src))->base._offsetJson);
|
||||
}
|
||||
else {
|
||||
(dst)._sid = 0;
|
||||
(dst)._data.length = 0;
|
||||
(dst)._data.data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
|
||||
#include "v8-execution.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <locale>
|
||||
|
||||
#include <v8.h>
|
||||
|
||||
#include "V8/v8-conv.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -44,38 +39,18 @@ using namespace std;
|
|||
// --SECTION-- public types
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief execution context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct js_exec_context_s {
|
||||
v8::Isolate* _isolate;
|
||||
v8::Persistent<v8::Function> _func;
|
||||
v8::Persistent<v8::Object> _arguments;
|
||||
int _error;
|
||||
}
|
||||
js_exec_context_t;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief fetch the error code from an execution context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_GetErrorExecutionContext (TRI_js_exec_context_t const context) {
|
||||
return ((js_exec_context_t const*) context)->_error;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates a new execution context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TRI_js_exec_context_t TRI_CreateExecutionContext (char const* script,
|
||||
TRI_js_exec_context_t* TRI_CreateExecutionContext (char const* script,
|
||||
size_t length) {
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
js_exec_context_t* ctx = new js_exec_context_t;
|
||||
TRI_js_exec_context_t* ctx = new TRI_js_exec_context_t;
|
||||
ctx->_error = TRI_ERROR_NO_ERROR;
|
||||
|
||||
// execute script inside the context
|
||||
|
@ -85,7 +60,7 @@ TRI_js_exec_context_t TRI_CreateExecutionContext (char const* script,
|
|||
// compilation failed, return
|
||||
if (compiled.IsEmpty()) {
|
||||
ctx->_error = TRI_ERROR_INTERNAL;
|
||||
return (TRI_js_exec_context_t) ctx;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
// compute the function
|
||||
|
@ -99,12 +74,12 @@ TRI_js_exec_context_t TRI_CreateExecutionContext (char const* script,
|
|||
else {
|
||||
ctx->_error = TRI_ERROR_REQUEST_CANCELED;
|
||||
}
|
||||
return (TRI_js_exec_context_t) ctx;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
if (val.IsEmpty()) {
|
||||
ctx->_error = TRI_ERROR_INTERNAL;
|
||||
return (TRI_js_exec_context_t) ctx;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
ctx->_func = v8::Persistent<v8::Function>::New(isolate, v8::Handle<v8::Function>::Cast(val));
|
||||
|
@ -113,18 +88,14 @@ TRI_js_exec_context_t TRI_CreateExecutionContext (char const* script,
|
|||
ctx->_error = TRI_ERROR_NO_ERROR;
|
||||
|
||||
// return the handle
|
||||
return (TRI_js_exec_context_t) ctx;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief frees an new execution context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_FreeExecutionContext (TRI_js_exec_context_t context) {
|
||||
js_exec_context_t* ctx;
|
||||
|
||||
ctx = (js_exec_context_t*) context;
|
||||
|
||||
void TRI_FreeExecutionContext (TRI_js_exec_context_t* ctx) {
|
||||
if (ctx->_error == TRI_ERROR_NO_ERROR) {
|
||||
ctx->_func.Dispose(ctx->_isolate);
|
||||
ctx->_func.Clear();
|
||||
|
@ -144,11 +115,7 @@ void TRI_FreeExecutionContext (TRI_js_exec_context_t context) {
|
|||
/// @brief executes a result context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TRI_json_t* TRI_ExecuteResultContext (TRI_js_exec_context_t context) {
|
||||
js_exec_context_t* ctx;
|
||||
|
||||
ctx = (js_exec_context_t*) context;
|
||||
|
||||
TRI_json_t* TRI_ExecuteResultContext (TRI_js_exec_context_t* ctx) {
|
||||
assert(ctx->_error == TRI_ERROR_NO_ERROR);
|
||||
|
||||
// convert back into a handle
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#define TRIAGENS_V8_V8_EXECUTION_H 1
|
||||
|
||||
#include "BasicsC/common.h"
|
||||
#include "Basics/Common.h"
|
||||
|
||||
#include <v8.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -48,29 +51,29 @@ struct TRI_json_s;
|
|||
/// @brief execution context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef void* TRI_js_exec_context_t;
|
||||
typedef struct TRI_js_exec_context_s {
|
||||
v8::Isolate* _isolate;
|
||||
v8::Persistent<v8::Function> _func;
|
||||
v8::Persistent<v8::Object> _arguments;
|
||||
int _error;
|
||||
}
|
||||
TRI_js_exec_context_t;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief fetch the error code from an execution context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_GetErrorExecutionContext (TRI_js_exec_context_t const);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates a new execution context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TRI_js_exec_context_t TRI_CreateExecutionContext (const char*, size_t);
|
||||
TRI_js_exec_context_t* TRI_CreateExecutionContext (const char*, size_t);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief frees an new execution context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_FreeExecutionContext (TRI_js_exec_context_t);
|
||||
void TRI_FreeExecutionContext (TRI_js_exec_context_t*);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
|
@ -80,7 +83,7 @@ void TRI_FreeExecutionContext (TRI_js_exec_context_t);
|
|||
/// @brief executes a result context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct TRI_json_s* TRI_ExecuteResultContext (TRI_js_exec_context_t context);
|
||||
struct TRI_json_s* TRI_ExecuteResultContext (TRI_js_exec_context_t* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue