bool TRI_InjectBindParametersAql (TRI_aql_context_t* const context) { TRI_aql_statement_walker_t* walker; assert(context); if (TRI_GetLengthAssociativePointer(&context->_parameters._names) == 0) { // no bind parameters used in query, instantly return return true; } walker = TRI_CreateStatementWalkerAql(context, true, &InjectParameter, NULL, NULL); if (walker == NULL) { TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL); return false; } TRI_WalkStatementsAql(walker, context->_statements); TRI_FreeStatementWalkerAql(walker); walker = TRI_CreateStatementWalkerAql(context, true, &FixAttributeAccess, NULL, NULL); if (walker == NULL) { TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL); return false; } TRI_WalkStatementsAql(walker, context->_statements); TRI_FreeStatementWalkerAql(walker); return true; }
TRI_json_t* TRI_ExplainAql (TRI_aql_context_t* const context) { TRI_aql_statement_walker_t* walker; TRI_aql_explain_t* explain; TRI_json_t* result; explain = CreateExplain(context); if (explain == NULL) { TRI_SetErrorContextAql(__FILE__, __LINE__, context, TRI_ERROR_OUT_OF_MEMORY, NULL); return NULL; } walker = TRI_CreateStatementWalkerAql((void*) explain, false, NULL, &ProcessStatement, NULL); if (walker == NULL) { FreeExplain(explain); TRI_SetErrorContextAql(__FILE__, __LINE__, context, TRI_ERROR_OUT_OF_MEMORY, NULL); return NULL; } TRI_WalkStatementsAql(walker, context->_statements); result = explain->_result; FreeExplain(explain); TRI_FreeStatementWalkerAql(walker); return result; }
void TRI_DumpStatementsAql (TRI_aql_statement_list_t* const statements) { TRI_aql_statement_walker_t* walker; TRI_aql_dump_t state; state._indent = 0; walker = TRI_CreateStatementWalkerAql((void*) &state, false, &DumpNode, &DumpStatementStart, &DumpStatementEnd); if (walker == NULL) { return; } TRI_WalkStatementsAql(walker, statements); TRI_FreeStatementWalkerAql(walker); }
static bool DetermineIndexes (aql_optimiser_t* const optimiser) { TRI_aql_statement_walker_t* walker; walker = TRI_CreateStatementWalkerAql((void*) optimiser, false, &AnnotateNode, NULL, NULL); if (walker == NULL) { TRI_SetErrorContextAql(optimiser->_context, TRI_ERROR_OUT_OF_MEMORY, NULL); return false; } TRI_WalkStatementsAql(walker, optimiser->_context->_statements); TRI_FreeStatementWalkerAql(walker); return true; }
static bool OptimiseAst (aql_optimiser_t* const optimiser) { TRI_aql_statement_walker_t* walker; walker = TRI_CreateStatementWalkerAql((void*) optimiser, true, &OptimiseNode, NULL, &ProcessStatement); if (walker == NULL) { TRI_SetErrorContextAql(optimiser->_context, TRI_ERROR_OUT_OF_MEMORY, NULL); return false; } TRI_WalkStatementsAql(walker, optimiser->_context->_statements); TRI_FreeStatementWalkerAql(walker); return true; }