Thu, 21 Dec 2017 19:48:27 +0100
davql: allow ANYWHERE keyword in SELECT statements
This may seem pointless, but users might want to be explicit about this and the grammar is more consistent.
This commit also adds some no-ops to the functions body of the SET parser, because some day the grammar might allow more clauses after the WHERE clause.
libidav/davqlparser.c | file | annotate | diff | comparison | revisions | |
libidav/davqlparser.h | file | annotate | diff | comparison | revisions |
--- a/libidav/davqlparser.c Thu Dec 21 19:42:25 2017 +0100 +++ b/libidav/davqlparser.c Thu Dec 21 19:48:27 2017 +0100 @@ -1613,6 +1613,11 @@ tokens = tokens->next; tokens = ucx_list_get(tokens, dav_parse_where_clause(stmt, tokens)); + } else if (token_is(tokens, DAVQL_TOKEN_KEYWORD) + && tokenvalue_is(tokens, "anywhere")) { + // useless, but the user may want to explicitly express his intent + tokens = tokens->next; + stmt->where = NULL; } if (stmt->errorcode) { return; @@ -1694,10 +1699,12 @@ } else if (token_is(tokens, DAVQL_TOKEN_KEYWORD) && tokenvalue_is(tokens, "anywhere")) { // no-op, but we want the user to be explicit about this + tokens = tokens->next; stmt->where = NULL; } else { dav_error_in_context(DAVQL_ERROR_MISSING_TOKEN, _error_missing_where, stmt, tokens); + return; } }
--- a/libidav/davqlparser.h Thu Dec 21 19:42:25 2017 +0100 +++ b/libidav/davqlparser.h Thu Dec 21 19:48:27 2017 +0100 @@ -225,7 +225,7 @@ * SelectStatement = "select ", FieldExpressions, * " from ", Path, * [" with ", WithClause], - * [" where ", LogicalExpression], + * [(" where ", LogicalExpression) | " anywhere"], * [" order by ", OrderByClause]; * </pre> *