Code

store: Removed sdb_store_matcher_tostring().
[sysdb.git] / src / core / store-private.h
index b8f27e25e20ff0f7af2c34f7a98ba9df93f4728c..c6350b3530c4a2518ce0a515da601c1256768700 100644 (file)
@@ -103,6 +103,27 @@ typedef struct {
 #define _last_update super.last_update
 #define _interval super.interval
 
+/*
+ * expressions
+ */
+enum {
+       ATTR_VALUE  = -2, /* attr name stored in data.data.string */
+       FIELD_VALUE = -1, /* field type stored in data.data.integer */
+       /*  0: const value (stored in data) */
+       /* >0: operator id */
+};
+
+struct sdb_store_expr {
+       sdb_object_t super;
+
+       int type; /* see above */
+
+       sdb_store_expr_t *left;
+       sdb_store_expr_t *right;
+
+       sdb_data_t data;
+};
+
 /*
  * conditionals
  */
@@ -135,8 +156,8 @@ typedef struct {
  * matchers
  */
 
-/* when adding to this, also update 'matchers' and 'matchers_tostring'
- * in store_lookup.c */
+/* when adding to this, also update 'MATCHER_SYM' below and 'matchers' in
+ * store_lookup.c */
 enum {
        MATCHER_OR,
        MATCHER_AND,
@@ -154,9 +175,14 @@ enum {
        MATCHER_CMP_LT,
        MATCHER_CMP_LE,
        MATCHER_CMP_EQ,
+       MATCHER_CMP_NE,
        MATCHER_CMP_GE,
        MATCHER_CMP_GT,
+       MATCHER_IN,
+       MATCHER_REGEX,
+       MATCHER_NREGEX,
        MATCHER_ISNULL,
+       MATCHER_ISNNULL,
 };
 
 #define MATCHER_SYM(t) \
@@ -171,9 +197,14 @@ enum {
                : ((t) == MATCHER_LT) ? "<" \
                : ((t) == MATCHER_LE) ? "<=" \
                : ((t) == MATCHER_EQ) ? "=" \
+               : ((t) == MATCHER_CMP_NE) ? "!=" \
                : ((t) == MATCHER_GE) ? ">=" \
                : ((t) == MATCHER_GT) ? ">" \
+               : ((t) == MATCHER_IN) ? "IN" \
+               : ((t) == MATCHER_REGEX) ? "=~" \
+               : ((t) == MATCHER_NREGEX) ? "!~" \
                : ((t) == MATCHER_ISNULL) ? "IS NULL" \
+               : ((t) == MATCHER_ISNNULL) ? "IS NOT NULL" \
                : "UNKNOWN")
 
 /* match the name of something */
@@ -245,7 +276,7 @@ typedef struct {
 
 typedef struct {
        sdb_store_matcher_t super;
-       char *attr_name; /* we only support matching attributes */
+       sdb_store_expr_t *expr;
 } isnull_matcher_t;
 #define ISNULL_M(m) ((isnull_matcher_t *)(m))