# HG changeset patch # User Mike Becker # Date 1433232440 -7200 # Node ID 7072a2b4ae35452c4a9d9cc40e53853241da4673 # Parent b156cae29e65a2eaafdd8bafd7e15e1ef349175b renamed GET to SELECT in davql syntax diff -r b156cae29e65 -r 7072a2b4ae35 libidav/davqlexec.c --- a/libidav/davqlexec.c Sat May 30 21:43:36 2015 +0200 +++ b/libidav/davqlexec.c Tue Jun 02 10:07:20 2015 +0200 @@ -56,7 +56,7 @@ davqlerror_t error; sstr_t path = dav_format_string(sn->mp->allocator, st->path, ap, &error); - if(st->type == DAVQL_GET) { + if(st->type == DAVQL_SELECT) { dav_exec_get(sn, st, path.ptr, ap); } else { // TODO diff -r b156cae29e65 -r 7072a2b4ae35 libidav/davqlparser.c --- a/libidav/davqlparser.c Sat May 30 21:43:36 2015 +0200 +++ b/libidav/davqlparser.c Tue Jun 02 10:07:20 2015 +0200 @@ -41,7 +41,7 @@ static const char* _map_querytype(davqltype_t type) { switch(type) { case DAVQL_ERROR: return "ERROR"; - case DAVQL_GET: return "GET"; + case DAVQL_SELECT: return "SELECT"; case DAVQL_SET: return "SET"; default: return "unknown"; } @@ -434,7 +434,7 @@ static const char *special_token_symbols = ",()+-*/&|^~=!<>"; static _Bool iskeyword(DavQLToken *token) { - sstr_t keywords[] = {ST("get"), ST("set"), ST("from"), ST("at"), ST("as"), + sstr_t keywords[] ={ST("select"), ST("set"), ST("from"), ST("at"), ST("as"), ST("where"), ST("with"), ST("order"), ST("by"), ST("asc"), ST("desc") }; for (int i = 0 ; i < sizeof(keywords)/sizeof(sstr_t) ; i++) { @@ -1413,12 +1413,12 @@ } /** - * Parser of a get statement. + * Parser of a select statement. * @param stmt the statement object that shall contain the syntax tree * @param tokens the token list */ -static void dav_parse_get_statement(DavQLStatement *stmt, UcxList *tokens) { - stmt->type = DAVQL_GET; +static void dav_parse_select_statement(DavQLStatement *stmt, UcxList *tokens) { + stmt->type = DAVQL_SELECT; // Consume field list tokens = ucx_list_get(tokens, dav_parse_fieldlist(stmt, tokens)); @@ -1546,8 +1546,8 @@ if (tokens) { // use first token to determine query type - if (tokenvalue_is(tokens, "get")) { - dav_parse_get_statement(stmt, tokens->next); + if (tokenvalue_is(tokens, "select")) { + dav_parse_select_statement(stmt, tokens->next); } else if (tokenvalue_is(tokens, "set")) { dav_parse_set_statement(stmt, tokens->next); } else { diff -r b156cae29e65 -r 7072a2b4ae35 libidav/davqlparser.h --- a/libidav/davqlparser.h Sat May 30 21:43:36 2015 +0200 +++ b/libidav/davqlparser.h Tue Jun 02 10:07:20 2015 +0200 @@ -40,7 +40,7 @@ /** * Enumeration of possible statement types. */ -typedef enum {DAVQL_ERROR, DAVQL_GET, DAVQL_SET} davqltype_t; +typedef enum {DAVQL_ERROR, DAVQL_SELECT, DAVQL_SET} davqltype_t; /** * Enumeration of possible token classes. @@ -135,7 +135,7 @@ /** * The field name. * */ @@ -143,7 +143,7 @@ /** * The field expression. * */ @@ -215,9 +215,9 @@ * arbitrary amount of optional spaces between two symbols if they are not part * of an literal or identifier. * - * GET: + * SELECT: *
- * GetStatement = "get ", FieldExpressions,
+ * SelectStatement = "select ", FieldExpressions,
  * " from ", Path,
  * [" with ", WithClause],
  * [" where ", LogicalExpression],