static inline TRI_json_t* GetRowProtoType (TRI_aql_explain_t* const explain, const TRI_aql_node_type_e type) { TRI_json_t* row; row = TRI_CreateArrayJson(TRI_UNKNOWN_MEM_ZONE); if (row == NULL) { return NULL; } TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "id", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, (double) ++explain->_count)); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "loopLevel", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, (double) explain->_level)); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "type", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, TRI_NodeNameAql(type))); return row; }
TRI_json_t* AutoIncrementKeyGenerator::toJson (TRI_memory_zone_t* zone) const { TRI_json_t* json = TRI_CreateArrayJson(zone); if (json != nullptr) { TRI_Insert3ArrayJson(zone, json, "type", TRI_CreateStringCopyJson(zone, name().c_str())); TRI_Insert3ArrayJson(zone, json, "allowUserKeys", TRI_CreateBooleanJson(zone, _allowUserKeys)); TRI_Insert3ArrayJson(zone, json, "offset", TRI_CreateNumberJson(zone, (double) _offset)); TRI_Insert3ArrayJson(zone, json, "increment", TRI_CreateNumberJson(zone, (double) _increment)); } return json; }
int TRI_SaveCollectionInfo (char const* path, const TRI_col_info_t* const info) { TRI_json_t* json; char* filename; bool ok; filename = TRI_Concatenate2File(path, TRI_COL_PARAMETER_FILE); // create a json info object json = TRI_CreateArrayJson(TRI_UNKNOWN_MEM_ZONE); if (json == NULL) { // out of memory LOG_ERROR("cannot save info block '%s': out of memory", filename); TRI_FreeString(TRI_CORE_MEM_ZONE, filename); return TRI_ERROR_OUT_OF_MEMORY; } TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "version", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, info->_version)); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "type", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, info->_type)); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "cid", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, info->_cid)); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "deleted", TRI_CreateBooleanJson(TRI_UNKNOWN_MEM_ZONE, info->_deleted)); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "maximalSize", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, info->_maximalSize)); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "name", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, info->_name)); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "isVolatile", TRI_CreateBooleanJson(TRI_UNKNOWN_MEM_ZONE, info->_isVolatile)); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "waitForSync", TRI_CreateBooleanJson(TRI_UNKNOWN_MEM_ZONE, info->_waitForSync)); if (info->_keyOptions) { TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "keyOptions", TRI_CopyJson(TRI_UNKNOWN_MEM_ZONE, info->_keyOptions)); } // save json info to file ok = TRI_SaveJson(filename, json); TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); if (! ok) { LOG_ERROR("cannot save info block '%s': '%s'", filename, TRI_last_error()); TRI_FreeString(TRI_CORE_MEM_ZONE, filename); return TRI_errno(); } TRI_FreeString(TRI_CORE_MEM_ZONE, filename); return TRI_ERROR_NO_ERROR; }
static TRI_json_t* AutoIncrementToJson (const TRI_key_generator_t* const generator) { TRI_json_t* json; autoincrement_keygen_t* data; data = (autoincrement_keygen_t*) generator->_data; assert(data != NULL); json = TRI_CreateArrayJson(TRI_CORE_MEM_ZONE); if (json != NULL) { TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "type", TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, AutoIncrementName)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "allowUserKeys", TRI_CreateBooleanJson(TRI_CORE_MEM_ZONE, data->_allowUserKeys)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "offset", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) data->_offset)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "increment", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) data->_increment)); } return json; }
static TRI_json_t* JsonCapConstraint (TRI_index_t const* idx) { TRI_json_t* json; // recast as a cap constraint TRI_cap_constraint_t const* cap = (TRI_cap_constraint_t const*) idx; // create json object and fill it json = TRI_JsonIndex(TRI_CORE_MEM_ZONE, idx); if (json == nullptr) { return nullptr; } TRI_Insert3ObjectJson(TRI_CORE_MEM_ZONE, json, "size", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) cap->_count)); TRI_Insert3ObjectJson(TRI_CORE_MEM_ZONE, json, "byteSize", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) cap->_size)); return json; }
static TRI_json_t* JsonCapConstraint (TRI_index_t* idx, TRI_primary_collection_t const* primary) { TRI_json_t* json; TRI_cap_constraint_t* cap; // recast as a cap constraint cap = (TRI_cap_constraint_t*) idx; // create json object and fill it json = TRI_JsonIndex(TRI_CORE_MEM_ZONE, idx); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "size", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, cap->_size)); return json; }
TRI_json_t* TRI_JsonVocBaseDefaults (TRI_memory_zone_t* zone, TRI_vocbase_defaults_t const* defaults) { TRI_json_t* json; json = TRI_CreateArrayJson(zone); if (json == NULL) { return NULL; } TRI_Insert3ArrayJson(zone, json, "removeOnDrop", TRI_CreateBooleanJson(zone, defaults->removeOnDrop)); TRI_Insert3ArrayJson(zone, json, "removeOnCompacted", TRI_CreateBooleanJson(zone, defaults->removeOnCompacted)); TRI_Insert3ArrayJson(zone, json, "waitForSync", TRI_CreateBooleanJson(zone, defaults->defaultWaitForSync)); TRI_Insert3ArrayJson(zone, json, "forceSyncShapes", TRI_CreateBooleanJson(zone, defaults->forceSyncShapes)); TRI_Insert3ArrayJson(zone, json, "forceSyncProperties", TRI_CreateBooleanJson(zone, defaults->forceSyncProperties)); TRI_Insert3ArrayJson(zone, json, "requireAuthentication", TRI_CreateBooleanJson(zone, defaults->requireAuthentication)); TRI_Insert3ArrayJson(zone, json, "authenticateSystemOnly", TRI_CreateBooleanJson(zone, defaults->authenticateSystemOnly)); TRI_Insert3ArrayJson(zone, json, "defaultMaximalSize", TRI_CreateNumberJson(zone, (double) defaults->defaultMaximalSize)); return json; }
static TRI_json_t* JsonState (TRI_replication_applier_state_t const* state) { TRI_json_t* json; TRI_json_t* last; TRI_json_t* progress; TRI_json_t* error; char* lastString; char timeString[24]; json = TRI_CreateArray2Json(TRI_CORE_MEM_ZONE, 9); // add replication state TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "running", TRI_CreateBooleanJson(TRI_CORE_MEM_ZONE, state->_active)); // lastAppliedContinuousTick if (state->_lastAppliedContinuousTick > 0) { lastString = TRI_StringUInt64(state->_lastAppliedContinuousTick); last = TRI_CreateStringJson(TRI_CORE_MEM_ZONE, lastString); } else { last = TRI_CreateNullJson(TRI_CORE_MEM_ZONE); } TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "lastAppliedContinuousTick", last); // lastProcessedContinuousTick if (state->_lastProcessedContinuousTick > 0) { lastString = TRI_StringUInt64(state->_lastProcessedContinuousTick); last = TRI_CreateStringJson(TRI_CORE_MEM_ZONE, lastString); } else { last = TRI_CreateNullJson(TRI_CORE_MEM_ZONE); } TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "lastProcessedContinuousTick", last); // lastAvailableContinuousTick if (state->_lastAvailableContinuousTick > 0) { lastString = TRI_StringUInt64(state->_lastAvailableContinuousTick); last = TRI_CreateStringJson(TRI_CORE_MEM_ZONE, lastString); } else { last = TRI_CreateNullJson(TRI_CORE_MEM_ZONE); } TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "lastAvailableContinuousTick", last); // progress progress = TRI_CreateArray2Json(TRI_CORE_MEM_ZONE, 2); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, progress, "time", TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, state->_progressTime)); if (state->_progressMsg != NULL) { TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, progress, "message", TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, state->_progressMsg)); } TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, progress, "failedConnects", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) state->_failedConnects)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "progress", progress); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "totalRequests", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) state->_totalRequests)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "totalFailedConnects", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) state->_totalFailedConnects)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "totalEvents", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) state->_totalEvents)); // lastError error = TRI_CreateArrayJson(TRI_CORE_MEM_ZONE); if (error != NULL) { if (state->_lastError._code > 0) { TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, error, "time", TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, state->_lastError._time)); if (state->_lastError._msg != NULL) { TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, error, "errorMessage", TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, state->_lastError._msg)); } } TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, error, "errorNum", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) state->_lastError._code)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "lastError", error); } TRI_GetTimeStampReplication(timeString, sizeof(timeString) - 1); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "time", TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, timeString)); return json; }
static TRI_json_t* JsonConfiguration (TRI_replication_applier_configuration_t const* config, bool includePassword) { TRI_json_t* json; json = TRI_CreateArray2Json(TRI_CORE_MEM_ZONE, 9); if (json == NULL) { return NULL; } if (config->_endpoint != NULL) { TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "endpoint", TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, config->_endpoint)); } if (config->_database != NULL) { TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "database", TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, config->_database)); } if (config->_username != NULL) { TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "username", TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, config->_username)); } if (config->_password != NULL && includePassword) { TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "password", TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, config->_password)); } TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "requestTimeout", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, config->_requestTimeout)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "connectTimeout", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, config->_connectTimeout)); /* TODO: decide about the fate of this... TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "ignoreErrors", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) config->_ignoreErrors)); */ TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "maxConnectRetries", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) config->_maxConnectRetries)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "chunkSize", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) config->_chunkSize)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "autoStart", TRI_CreateBooleanJson(TRI_CORE_MEM_ZONE, config->_autoStart)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "adaptivePolling", TRI_CreateBooleanJson(TRI_CORE_MEM_ZONE, config->_adaptivePolling)); return json; }
TRI_json_t* TRI_NodeJsonAql (TRI_aql_context_t* const context, const TRI_aql_node_t* const node) { switch (node->_type) { case TRI_AQL_NODE_VALUE: { switch (node->_value._type) { case TRI_AQL_TYPE_FAIL: case TRI_AQL_TYPE_NULL: return TRI_CreateNullJson(TRI_UNKNOWN_MEM_ZONE); case TRI_AQL_TYPE_BOOL: return TRI_CreateBooleanJson(TRI_UNKNOWN_MEM_ZONE, node->_value._value._bool); case TRI_AQL_TYPE_INT: return TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, (double) node->_value._value._int); case TRI_AQL_TYPE_DOUBLE: return TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, node->_value._value._double); case TRI_AQL_TYPE_STRING: return TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, node->_value._value._string); } } case TRI_AQL_NODE_LIST: { TRI_json_t* result = TRI_CreateListJson(TRI_UNKNOWN_MEM_ZONE); if (result) { size_t i, n; n = node->_members._length; for (i = 0; i < n; ++i) { TRI_json_t* subValue = TRI_NodeJsonAql(context, TRI_AQL_NODE_MEMBER(node, i)); if (subValue) { TRI_PushBack3ListJson(TRI_UNKNOWN_MEM_ZONE, result, subValue); } } } return result; } case TRI_AQL_NODE_ARRAY: { TRI_json_t* result = TRI_CreateArrayJson(TRI_UNKNOWN_MEM_ZONE); if (result) { size_t i, n; n = node->_members._length; for (i = 0; i < n; ++i) { TRI_aql_node_t* element = TRI_AQL_NODE_MEMBER(node, i); TRI_json_t* subValue = TRI_NodeJsonAql(context, TRI_AQL_NODE_MEMBER(element, 0)); if (subValue) { TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, result, TRI_AQL_NODE_STRING(element), subValue); } } } return result; } default: { return NULL; } } }
TRI_json_t* TRI_GetJsonCollectionHintAql (TRI_aql_collection_hint_t* const hint) { TRI_json_t* result; if (hint == NULL) { return NULL; } result = TRI_CreateArrayJson(TRI_UNKNOWN_MEM_ZONE); if (result == NULL) { return NULL; } if (hint->_index == NULL) { // full table scan TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, result, "accessType", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, "all")); } else { // index usage TRI_index_t* idx = hint->_index->_idx; TRI_json_t* indexDescription; TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, result, "accessType", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, "index")); indexDescription = TRI_CreateArrayJson(TRI_UNKNOWN_MEM_ZONE); if (indexDescription != NULL) { TRI_string_buffer_t* buffer; char* idString = GetIndexIdString(hint); // index id if (idString != NULL) { TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, indexDescription, "id", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, idString)); TRI_FreeString(TRI_UNKNOWN_MEM_ZONE, idString); } // index type TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, indexDescription, "type", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, idx->typeName(idx))); // index attributes buffer = TRI_CreateStringBuffer(TRI_UNKNOWN_MEM_ZONE); if (buffer != NULL) { size_t i; for (i = 0; i < idx->_fields._length; i++) { if (i > 0) { TRI_AppendStringStringBuffer(buffer, ", "); } TRI_AppendStringStringBuffer(buffer, idx->_fields._buffer[i]); } TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, indexDescription, "attributes", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, buffer->_buffer)); TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, buffer); } } TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, result, "index", indexDescription); } if (hint->_limit._status == TRI_AQL_LIMIT_USE) { TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, result, "limit", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, (double) hint->_limit._offset + (double) hint->_limit._limit)); } return result; }
static TRI_aql_node_t* ProcessStatement (TRI_aql_statement_walker_t* const walker, TRI_aql_node_t* node) { TRI_aql_explain_t* explain; TRI_aql_node_type_e type = node->_type; explain = (TRI_aql_explain_t*) walker->_data; switch (type) { case TRI_AQL_NODE_SCOPE_START: { TRI_aql_scope_t* scope = (TRI_aql_scope_t*) TRI_AQL_NODE_DATA(node); assert(scope); if (scope->_type != TRI_AQL_SCOPE_SUBQUERY && scope->_type != TRI_AQL_SCOPE_MAIN) { ++explain->_level; } break; } case TRI_AQL_NODE_SCOPE_END: { TRI_aql_scope_t* scope = (TRI_aql_scope_t*) TRI_AQL_NODE_DATA(node); assert(scope); if (scope->_type != TRI_AQL_SCOPE_SUBQUERY && scope->_type != TRI_AQL_SCOPE_MAIN) { --explain->_level; } break; } case TRI_AQL_NODE_EXPAND: { TRI_aql_node_t* variableNode; TRI_json_t* row; row = GetRowProtoType(explain, TRI_AQL_NODE_REFERENCE); variableNode = TRI_AQL_NODE_MEMBER(node, 0); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "resultVariable", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, TRI_AQL_NODE_STRING(variableNode))); AddNodeValue(row, TRI_AQL_NODE_MEMBER(node, 2)); AddRow(explain, row); row = GetRowProtoType(explain, TRI_AQL_NODE_EXPAND); variableNode = TRI_AQL_NODE_MEMBER(node, 1); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "resultVariable", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, TRI_AQL_NODE_STRING(variableNode))); AddNodeValue(row, TRI_AQL_NODE_MEMBER(node, 3)); AddRow(explain, row); break; } case TRI_AQL_NODE_SUBQUERY: { TRI_aql_node_t* variableNode = TRI_AQL_NODE_MEMBER(node, 0); TRI_json_t* row; row = GetRowProtoType(explain, node->_type); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "resultVariable", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, TRI_AQL_NODE_STRING(variableNode))); AddRow(explain, row); break; } case TRI_AQL_NODE_FOR: { TRI_aql_node_t* variableNode = TRI_AQL_NODE_MEMBER(node, 0); TRI_aql_node_t* expressionNode = TRI_AQL_NODE_MEMBER(node, 1); TRI_json_t* row; row = GetRowProtoType(explain, node->_type); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "resultVariable", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, TRI_AQL_NODE_STRING(variableNode))); AddNodeValue(row, expressionNode); AddRow(explain, row); break; } case TRI_AQL_NODE_RETURN: case TRI_AQL_NODE_RETURN_EMPTY: { TRI_aql_node_t* expressionNode = TRI_AQL_NODE_MEMBER(node, 0); TRI_json_t* row; row = GetRowProtoType(explain, node->_type); AddNodeValue(row, expressionNode); AddRow(explain, row); break; } case TRI_AQL_NODE_FILTER: { TRI_aql_node_t* expressionNode = TRI_AQL_NODE_MEMBER(node, 0); TRI_json_t* row; row = GetRowProtoType(explain, node->_type); AddNodeValue(row, expressionNode); AddRow(explain, row); break; } case TRI_AQL_NODE_LET: { TRI_aql_node_t* variableNode = TRI_AQL_NODE_MEMBER(node, 0); TRI_aql_node_t* expressionNode = TRI_AQL_NODE_MEMBER(node, 1); TRI_json_t* row; row = GetRowProtoType(explain, node->_type); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "resultVariable", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, TRI_AQL_NODE_STRING(variableNode))); AddNodeValue(row, expressionNode); AddRow(explain, row); break; } case TRI_AQL_NODE_SORT: { TRI_aql_node_t* listNode = TRI_AQL_NODE_MEMBER(node, 0); TRI_json_t* row; row = GetRowProtoType(explain, node->_type); AddNodeValue(row, listNode); AddRow(explain, row); break; } case TRI_AQL_NODE_LIMIT: { TRI_aql_node_t* offsetNode = TRI_AQL_NODE_MEMBER(node, 0); TRI_aql_node_t* countNode = TRI_AQL_NODE_MEMBER(node, 1); TRI_json_t* row; row = GetRowProtoType(explain, node->_type); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "offset", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, (double) TRI_AQL_NODE_INT(offsetNode))); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "count", TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, (double) TRI_AQL_NODE_INT(countNode))); AddRow(explain, row); break; } case TRI_AQL_NODE_COLLECT: { TRI_aql_node_t* listNode = TRI_AQL_NODE_MEMBER(node, 0); TRI_json_t* row; row = GetRowProtoType(explain, node->_type); if (node->_members._length > 1) { TRI_aql_node_t* variableNode = TRI_AQL_NODE_MEMBER(node, 1); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, row, "resultVariable", TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE, TRI_AQL_NODE_STRING(variableNode))); } AddNodeValue(row, listNode); AddRow(explain, row); break; } default: { } } return NULL; }