diff options
author | unknown <bell@sanja.is.com.ua> | 2002-12-15 11:14:53 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2002-12-15 11:14:53 +0200 |
commit | 1062220566db3fc475dc83c27c0e476156232400 (patch) | |
tree | 1cd675e1a98f5a3bf624aa99ee733c3efb130f5d | |
parent | 71a6aa3b0c6b15d57e8552e59c094caf4ce6f41a (diff) | |
download | mariadb-git-1062220566db3fc475dc83c27c0e476156232400.tar.gz |
fixed subselect null test
fixed method definition (overloading instead of redefinition)
fixed time expression type definition
mysql-test/r/subselect.result:
test of subselect null test
mysql-test/t/subselect.test:
test of subselect null test
sql/item.h:
fixed method definition (overloading instead of redefinition)
sql/item_subselect.h:
fixed subselect null test
sql/item_timefunc.cc:
fixed time expression type definition
-rw-r--r-- | mysql-test/r/subselect.result | 5 | ||||
-rw-r--r-- | mysql-test/t/subselect.test | 2 | ||||
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | sql/item_subselect.h | 6 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 2 |
5 files changed, 14 insertions, 3 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 6073ebb933f..493768ece4a 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -47,6 +47,11 @@ select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1)); Wrong usage of PROCEDURE and subquery SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); Incorrect parameters to procedure 'ANALYSE' +SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; +a +SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; +a +1 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; create table t1 (a int); create table t2 (a int, b int); diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 6a212c38255..0527d6a2001 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -24,6 +24,8 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a)); select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1)); -- error 1108 SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); +SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; +SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; create table t1 (a int); diff --git a/sql/item.h b/sql/item.h index a4156482907..1ea76731fd3 100644 --- a/sql/item.h +++ b/sql/item.h @@ -208,7 +208,7 @@ public: { return field->result_type(); } - enum_field_types field_type() + enum_field_types field_type() const { return field->type(); } diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 7e46af09e2a..0e6f939803d 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -75,7 +75,11 @@ public: bool assigned() { return value_assigned; } void assigned(bool a) { value_assigned= a; } enum Type type() const; - bool is_null() { return null_value; } + bool is_null() + { + val_int(); + return null_value; + } bool fix_fields(THD *thd, TABLE_LIST *tables, Item **ref); virtual void fix_length_and_dec(); table_map used_tables() const; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 7b58fbe8404..061cf208052 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1025,7 +1025,7 @@ void Item_date_add_interval::fix_length_and_dec() cached_field_type= MYSQL_TYPE_DATETIME; else if (arg0_field_type == MYSQL_TYPE_DATE) { - if (int_type <= INTERVAL_MONTH || int_type == INTERVAL_YEAR_MONTH) + if (int_type <= INTERVAL_DAY || int_type == INTERVAL_YEAR_MONTH) cached_field_type= arg0_field_type; else cached_field_type= MYSQL_TYPE_DATETIME; |