summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2016-10-25 10:09:33 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2016-10-25 10:09:33 +0400
commit201c1e0f299f115cda2361ae0535507393872318 (patch)
tree1378647f92b8b803c931dbe6c1da0e398de52563
parentb09b3161799e1e22b6cf3a434bc85e929939bc6c (diff)
downloadmariadb-git-201c1e0f299f115cda2361ae0535507393872318.tar.gz
MDEV-9143 JSON_xxx functions.
Item_bool fixed to behave smarter with NOT operation.
-rw-r--r--mysql-test/r/null.result2
-rw-r--r--mysql-test/r/parser_precedence.result2
-rw-r--r--sql/item.cc8
-rw-r--r--sql/item.h1
4 files changed, 11 insertions, 2 deletions
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index 222ccc809b1..1686bc7dbd3 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -1584,7 +1584,7 @@ SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (((`test`.`t1`.`c1` is not null) >= <cache>((not(1)))) is not null)
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (((`test`.`t1`.`c1` is not null) >= 0) is not null)
SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL;
c1
1
diff --git a/mysql-test/r/parser_precedence.result b/mysql-test/r/parser_precedence.result
index 5225dad1668..4330c8a2045 100644
--- a/mysql-test/r/parser_precedence.result
+++ b/mysql-test/r/parser_precedence.result
@@ -369,7 +369,7 @@ select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
0 1 0
Testing that NOT is associative
select NOT NOT TRUE, NOT NOT NOT FALSE;
-TRUE NOT NOT NOT FALSE
+NOT NOT TRUE NOT NOT NOT FALSE
1 1
Testing that IS has precedence over NOT
select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
diff --git a/sql/item.cc b/sql/item.cc
index 448e34b89e3..2388679e424 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -2900,6 +2900,14 @@ void Item_int::print(String *str, enum_query_type query_type)
}
+Item *Item_bool::neg_transformer(THD *thd)
+{
+ value= !value;
+ name= 0;
+ return this;
+}
+
+
Item_uint::Item_uint(THD *thd, const char *str_arg, uint length):
Item_int(thd, str_arg, length)
{
diff --git a/sql/item.h b/sql/item.h
index 76442351d0d..ab70fdb7dc1 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -3008,6 +3008,7 @@ public:
Item_bool(THD *thd, const char *str_arg, longlong i):
Item_int(thd, str_arg, i, 1) {}
bool is_bool_type() { return true; }
+ Item *neg_transformer(THD *thd);
};