wbemprox: Add support for negated expressions in WHERE clauses.

This commit is contained in:
Hans Leidekker 2014-02-28 11:23:39 +01:00 committed by Alexandre Julliard
parent 14bc54d536
commit d0d9b9dcd7
3 changed files with 17 additions and 1 deletions

View File

@ -250,6 +250,15 @@ static HRESULT eval_unary( const struct table *table, UINT row, const struct com
UINT column; UINT column;
LONGLONG lval; 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 ); hr = get_column_index( table, expr->left->u.propval->name, &column );
if (hr != S_OK) if (hr != S_OK)
return hr; return hr;

View File

@ -53,7 +53,8 @@ enum operator
OP_NE = 8, OP_NE = 8,
OP_ISNULL = 9, OP_ISNULL = 9,
OP_NOTNULL = 10, OP_NOTNULL = 10,
OP_LIKE = 11 OP_LIKE = 11,
OP_NOT = 12
}; };
struct expr; struct expr;

View File

@ -318,6 +318,12 @@ expr:
if (!$$) if (!$$)
YYABORT; YYABORT;
} }
| TK_NOT expr
{
$$ = expr_unary( ctx, $2, OP_NOT );
if (!$$)
YYABORT;
}
| prop_val TK_EQ const_val | prop_val TK_EQ const_val
{ {
$$ = expr_complex( ctx, $1, OP_EQ, $3 ); $$ = expr_complex( ctx, $1, OP_EQ, $3 );