diff --git a/src/agents/store/query-parser.c b/src/agents/store/query-parser.c index f5962f4..71910c5 100644 --- a/src/agents/store/query-parser.c +++ b/src/agents/store/query-parser.c @@ -15,6 +15,7 @@ * Parser of Store Protocol queries into structures, for later use in SQL queries */ +#include "stored.h" #include #include #include @@ -151,7 +152,7 @@ QueryParserRun(struct parser_state *state) char *token; struct expression *current_expression = state->start; - while (pull_token(&(state->query), &token) != -1) { + while (pull_token(&(state->query_ptr), &token) != -1) { if (current_expression < state->start) { // ran off the top of our stack, but there were still tokens DEBUG_MESSAGE("ERR: tokens remaining in data\n"); @@ -261,6 +262,8 @@ QueryParserStart(struct parser_state *state, const char *query, int max_expr) { return -2; } + state->query_ptr = state->query; + return 0; } diff --git a/src/agents/store/query-parser.h b/src/agents/store/query-parser.h index 7a0286b..d61966b 100644 --- a/src/agents/store/query-parser.h +++ b/src/agents/store/query-parser.h @@ -21,6 +21,7 @@ struct parser_state { struct expression *last; int entries; char *query; + char *query_ptr; }; int QueryParserStart(struct parser_state *state, const char *query, int max_expr);