Commit ac97cce4 authored by unknown's avatar unknown

removed 'this' pointer from initialization list of constructors

parent 58dc0306
...@@ -32,11 +32,22 @@ SUBSELECT TODO: ...@@ -32,11 +32,22 @@ SUBSELECT TODO:
#include "mysql_priv.h" #include "mysql_priv.h"
#include "sql_select.h" #include "sql_select.h"
Item_subselect::Item_subselect(THD *thd, st_select_lex *select_lex, Item_subselect::Item_subselect():
select_subselect *result):
Item(), engine_owner(1), value_assigned(0) Item(), engine_owner(1), value_assigned(0)
{ {
DBUG_ENTER("Item_subselect::Item_subselect"); assign_null();
/*
item value is NULL if select_subselect not changed this value
(i.e. some rows will be found returned)
*/
null_value= 1;
}
void Item_subselect::init(THD *thd, st_select_lex *select_lex,
select_subselect *result)
{
DBUG_ENTER("Item_subselect::init");
DBUG_PRINT("subs", ("select_lex 0x%xl", (long) select_lex)); DBUG_PRINT("subs", ("select_lex 0x%xl", (long) select_lex));
if (select_lex->next_select()) if (select_lex->next_select())
...@@ -45,12 +56,6 @@ Item_subselect::Item_subselect(THD *thd, st_select_lex *select_lex, ...@@ -45,12 +56,6 @@ Item_subselect::Item_subselect(THD *thd, st_select_lex *select_lex,
else else
engine= new subselect_single_select_engine(thd, select_lex, result, engine= new subselect_single_select_engine(thd, select_lex, result,
this); this);
assign_null();
/*
item value is NULL if select_subselect not changed this value
(i.e. some rows will be found returned)
*/
null_value= 1;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -100,8 +105,9 @@ inline table_map Item_subselect::used_tables() const ...@@ -100,8 +105,9 @@ inline table_map Item_subselect::used_tables() const
Item_singleval_subselect::Item_singleval_subselect(THD *thd, Item_singleval_subselect::Item_singleval_subselect(THD *thd,
st_select_lex *select_lex): st_select_lex *select_lex):
Item_subselect(thd, select_lex, new select_singleval_subselect(this)) Item_subselect()
{ {
init(thd, select_lex, new select_singleval_subselect(this));
max_columns= 1; max_columns= 1;
maybe_null= 1; maybe_null= 1;
} }
...@@ -149,8 +155,9 @@ String *Item_singleval_subselect::val_str (String *str) ...@@ -149,8 +155,9 @@ String *Item_singleval_subselect::val_str (String *str)
Item_exists_subselect::Item_exists_subselect(THD *thd, Item_exists_subselect::Item_exists_subselect(THD *thd,
st_select_lex *select_lex): st_select_lex *select_lex):
Item_subselect(thd, select_lex, new select_exists_subselect(this)) Item_subselect()
{ {
init(thd, select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX; max_columns= UINT_MAX;
null_value= 0; //can't be NULL null_value= 0; //can't be NULL
maybe_null= 0; //can't be NULL maybe_null= 0; //can't be NULL
......
...@@ -39,8 +39,7 @@ protected: ...@@ -39,8 +39,7 @@ protected:
uint max_columns; uint max_columns;
public: public:
Item_subselect(THD *thd, st_select_lex *select_lex, Item_subselect();
select_subselect* result);
Item_subselect(Item_subselect *item) Item_subselect(Item_subselect *item)
{ {
null_value= item->null_value; null_value= item->null_value;
...@@ -50,6 +49,14 @@ public: ...@@ -50,6 +49,14 @@ public:
engine_owner= 0; engine_owner= 0;
name= item->name; name= item->name;
} }
/*
We need this method, because some compilers do not allow 'this'
pointer in constructor initialization list, but we need pass pointer
to subselect Item class to select_subselect classes constructor.
*/
void init (THD *thd, st_select_lex *select_lex, select_subselect *result);
~Item_subselect(); ~Item_subselect();
virtual void assign_null() virtual void assign_null()
{ {
......
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