Remove support for WHERE a != ?
Most NoSQL products cannot support the != operator, as this does
not provide a sufficient reduction in rows within the table space.
Remove the operator so that applications don't try to take advantage
of a feature that isn't fully portable.
Change-Id: I6aeb5fcc8e01428244d61d86c9466fbc2331cc28
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/src/main/antlr/com/google/gwtorm/schema/Query.g b/src/main/antlr/com/google/gwtorm/schema/Query.g
index b5e7a49..f3c5e8f 100644
--- a/src/main/antlr/com/google/gwtorm/schema/Query.g
+++ b/src/main/antlr/com/google/gwtorm/schema/Query.g
@@ -28,7 +28,6 @@
GT;
GE;
EQ;
- NE;
ID;
PLACEHOLDER;
COMMA;
@@ -175,7 +174,6 @@
| GT
| GE
| EQ
- | NE
;
field
@@ -211,7 +209,6 @@
GT : '>' ;
GE : '>=' ;
EQ : '=' ;
-NE : '!=' ;
PLACEHOLDER: '?' ;
COMMA: ',' ;
diff --git a/src/main/java/com/google/gwtorm/client/Query.java b/src/main/java/com/google/gwtorm/client/Query.java
index d22324f..f2d99bc 100644
--- a/src/main/java/com/google/gwtorm/client/Query.java
+++ b/src/main/java/com/google/gwtorm/client/Query.java
@@ -38,7 +38,7 @@
* [ORDER BY <property> [, <property> ...]]
* [LIMIT { <count> | ? }]
*
- * <condition> := <property> { < | <= | > | >= | = | != } <value>
+ * <condition> := <property> { < | <= | > | >= | = } <value>
* <value> := { ? | true | false | <int> | <string> }
* </pre>
* <p>
diff --git a/src/main/java/com/google/gwtorm/schema/QueryModel.java b/src/main/java/com/google/gwtorm/schema/QueryModel.java
index d737f16..44447e3 100644
--- a/src/main/java/com/google/gwtorm/schema/QueryModel.java
+++ b/src/main/java/com/google/gwtorm/schema/QueryModel.java
@@ -89,7 +89,6 @@
case QueryParser.GT:
case QueryParser.GE:
case QueryParser.EQ:
- case QueryParser.NE:
if (node.getChild(1).getType() == QueryParser.PLACEHOLDER) {
r.add(((QueryParser.Column) node.getChild(0)).getField());
}
@@ -181,11 +180,6 @@
fmt.buf.append(node.getText());
format(fmt, node.getChild(1));
break;
- case QueryParser.NE:
- format(fmt, node.getChild(0));
- fmt.buf.append("<>");
- format(fmt, node.getChild(1));
- break;
case QueryParser.ID: {
final ColumnModel col = ((QueryParser.Column) node).getField();
@@ -269,8 +263,7 @@
case QueryParser.LE:
case QueryParser.GT:
case QueryParser.GE:
- case QueryParser.EQ:
- case QueryParser.NE: {
+ case QueryParser.EQ: {
final Column qpc = (QueryParser.Column) node.getChild(0);
final ColumnModel f = qpc.getField();
if (f.isNested()) {