[3/3] wbemprox: Add support for negated expressions in WHERE clauses.

Hans Leidekker hans at codeweavers.com
Fri Feb 28 04:23:39 CST 2014


---
 dlls/wbemprox/query.c            | 9 +++++++++
 dlls/wbemprox/wbemprox_private.h | 3 ++-
 dlls/wbemprox/wql.y              | 6 ++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 6933da2..921c3cd 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -250,6 +250,15 @@ static HRESULT eval_unary( const struct table *table, UINT row, const struct com
     UINT column;
     LONGLONG lval;
 
+    if (expr->op == OP_NOT)
+    {
+        hr = eval_cond( table, row, expr->left, &lval, type );
+        if (hr != S_OK)
+            return hr;
+        *val = !lval;
+        return S_OK;
+    }
+
     hr = get_column_index( table, expr->left->u.propval->name, &column );
     if (hr != S_OK)
         return hr;
diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h
index 0e39d00..da4f84f 100644
--- a/dlls/wbemprox/wbemprox_private.h
+++ b/dlls/wbemprox/wbemprox_private.h
@@ -53,7 +53,8 @@ enum operator
     OP_NE      = 8,
     OP_ISNULL  = 9,
     OP_NOTNULL = 10,
-    OP_LIKE    = 11
+    OP_LIKE    = 11,
+    OP_NOT     = 12
 };
 
 struct expr;
diff --git a/dlls/wbemprox/wql.y b/dlls/wbemprox/wql.y
index 58663d0..6eabe19 100644
--- a/dlls/wbemprox/wql.y
+++ b/dlls/wbemprox/wql.y
@@ -318,6 +318,12 @@ expr:
             if (!$$)
                 YYABORT;
         }
+  | TK_NOT expr
+        {
+            $$ = expr_unary( ctx, $2, OP_NOT );
+            if (!$$)
+                YYABORT;
+        }
   | prop_val TK_EQ const_val
         {
             $$ = expr_complex( ctx, $1, OP_EQ, $3 );
-- 
1.8.5.3






More information about the wine-patches mailing list