Commit 96c5426c authored by Wyatt Alt's avatar Wyatt Alt Committed by Rob Browning

(PDB-3471) support != in PQL

parent a31acb99
...@@ -61,11 +61,12 @@ expr-not = ( not, [<whitespace>], expr-not ) | expr-rest; ...@@ -61,11 +61,12 @@ expr-not = ( not, [<whitespace>], expr-not ) | expr-rest;
subquery = entity, [<whitespace>], where; subquery = entity, [<whitespace>], where;
(* Conditional expression *) (* Conditional expression *)
condexpression = (condexpregexp | condexpregexparray | condexpinequality | condexpmatch | condexpin); condexpression = (condexpregexp | condexpregexparray | condexpinequality | condexpmatch | condexpnotmatch| condexpin);
<condexpregexp> = field, [<whitespace>], condregexp, [<whitespace>], valueregexp; <condexpregexp> = field, [<whitespace>], condregexp, [<whitespace>], valueregexp;
<condexpregexparray> = field, [<whitespace>], condregexparray, [<whitespace>], valueregexparray; <condexpregexparray> = field, [<whitespace>], condregexparray, [<whitespace>], valueregexparray;
<condexpinequality> = field, [<whitespace>], condinequality, [<whitespace>], valueordered; <condexpinequality> = field, [<whitespace>], condinequality, [<whitespace>], valueordered;
<condexpmatch> = field, [<whitespace>], condmatch, [<whitespace>], literal; <condexpmatch> = field, [<whitespace>], condmatch, [<whitespace>], literal;
<condexpnotmatch> = field, [<whitespace>], condnotmatch, [<whitespace>], literal;
<condexpin> = (field | groupedfieldlist), [<whitespace>], condin, [<whitespace>], valuein; <condexpin> = (field | groupedfieldlist), [<whitespace>], condin, [<whitespace>], valuein;
(* Special is null/is not null expression *) (* Special is null/is not null expression *)
...@@ -95,6 +96,7 @@ field = #'[a-zA-Z0-9_]+\??' | (dottedfield, fieldpath); ...@@ -95,6 +96,7 @@ field = #'[a-zA-Z0-9_]+\??' | (dottedfield, fieldpath);
<condregexparray> = '~>'; <condregexparray> = '~>';
<condinequality> = '>=' | '<=' | '<' | '>'; <condinequality> = '>=' | '<=' | '<' | '>';
<condmatch> = '='; <condmatch> = '=';
<condnotmatch> = '!=';
<condin> = 'in'; <condin> = 'in';
<valueregexp> = string; <valueregexp> = string;
......
...@@ -54,7 +54,9 @@ ...@@ -54,7 +54,9 @@
(defn transform-condexpression (defn transform-condexpression
[a b c] [a b c]
[b a c]) (if (= "!=" b)
["not" ["=" a c]]
[b a c]))
(defn transform-condexpnull (defn transform-condexpnull
[entity type] [entity type]
......
...@@ -345,6 +345,9 @@ ...@@ -345,6 +345,9 @@
"certname > 4" "certname > 4"
[:condexpression [:field "certname"] ">" [:integer "4"]] [:condexpression [:field "certname"] ">" [:integer "4"]]
"certname != 4"
[:condexpression [:field "certname"] "!=" [:integer "4"]]
"a in nodes [a] {}" "a in nodes [a] {}"
[:condexpression [:field "a"] "in" [:from "nodes" [:extract [:field "a"]]]]) [:condexpression [:field "a"] "in" [:from "nodes" [:extract [:field "a"]]]])
......
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
["from" "nodes" ["from" "nodes"
["=" "a" 1]] ["=" "a" 1]]
[:condexpression [:field "certname"] "!=" [:integer "4"]]
["not" ["=" "certname" 4]]
[:from "nodes" [:from "nodes"
[:extract "a" "b" "c"]] [:extract "a" "b" "c"]]
["from" "nodes" ["from" "nodes"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment