Commit 10622205 authored by unknown's avatar unknown

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
parent 71a6aa3b
...@@ -47,6 +47,11 @@ select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1)); ...@@ -47,6 +47,11 @@ select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
Wrong usage of PROCEDURE and subquery Wrong usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
Incorrect parameters to procedure 'ANALYSE' 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; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
create table t1 (a int); create table t1 (a int);
create table t2 (a int, b int); create table t2 (a int, b int);
......
...@@ -24,6 +24,8 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a)); ...@@ -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)); select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
-- error 1108 -- error 1108
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); 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; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
create table t1 (a int); create table t1 (a int);
......
...@@ -208,7 +208,7 @@ public: ...@@ -208,7 +208,7 @@ public:
{ {
return field->result_type(); return field->result_type();
} }
enum_field_types field_type() enum_field_types field_type() const
{ {
return field->type(); return field->type();
} }
......
...@@ -75,7 +75,11 @@ public: ...@@ -75,7 +75,11 @@ public:
bool assigned() { return value_assigned; } bool assigned() { return value_assigned; }
void assigned(bool a) { value_assigned= a; } void assigned(bool a) { value_assigned= a; }
enum Type type() const; 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); bool fix_fields(THD *thd, TABLE_LIST *tables, Item **ref);
virtual void fix_length_and_dec(); virtual void fix_length_and_dec();
table_map used_tables() const; table_map used_tables() const;
......
...@@ -1025,7 +1025,7 @@ void Item_date_add_interval::fix_length_and_dec() ...@@ -1025,7 +1025,7 @@ void Item_date_add_interval::fix_length_and_dec()
cached_field_type= MYSQL_TYPE_DATETIME; cached_field_type= MYSQL_TYPE_DATETIME;
else if (arg0_field_type == MYSQL_TYPE_DATE) 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; cached_field_type= arg0_field_type;
else else
cached_field_type= MYSQL_TYPE_DATETIME; cached_field_type= MYSQL_TYPE_DATETIME;
......
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