Code

store, frontend: Added support for iterating arrays (using ALL / ANY).
[sysdb.git] / src / frontend / grammar.y
index 2e5274469057b12ac195997982e4018df727268e..80fb249684e0120be85cd421905fec666d277bc4 100644 (file)
@@ -515,14 +515,6 @@ expression:
                        sdb_object_deref(SDB_OBJ($3)); $3 = NULL;
                }
        |
-       HOST_T
-               {
-                       /* XXX: this doesn't work correctly when not
-                        * querying hosts => use <type>.<field> instead
-                        * and let the analyzer verify <type> */
-                       $$ = sdb_store_expr_fieldvalue(SDB_FIELD_NAME);
-               }
-       |
        field
                {
                        $$ = sdb_store_expr_fieldvalue($1);
@@ -563,6 +555,8 @@ iterable:
        METRIC_T { $$ = SDB_METRIC; }
        |
        ATTRIBUTE_T { $$ = SDB_ATTRIBUTE; }
+       |
+       BACKEND_T { $$ = SDB_FIELD_BACKEND; }
        ;
 
 field:
@@ -678,13 +672,15 @@ name_iter_matcher(int m_type, int type, const char *cmp,
        sdb_store_matcher_t *m, *tmp = NULL;
        assert(cb);
 
-       /* TODO: this only works as long as queries
-        * are limited to hosts */
+       /* hosts are never iterable */
        if (type == SDB_HOST) {
                return NULL;
        }
 
-       e = sdb_store_expr_fieldvalue(SDB_FIELD_NAME);
+       if (type == SDB_FIELD_BACKEND)
+               e = sdb_store_expr_fieldvalue(type);
+       else
+               e = sdb_store_expr_fieldvalue(SDB_FIELD_NAME);
        m = cb(e, expr);
        if (m_type == MATCHER_ANY)
                tmp = sdb_store_any_matcher(type, m);