Commit 2c951d4c authored by unknown's avatar unknown

Merge laptop.sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into laptop.sanja.is.com.ua:/home/bell/mysql/bk/work-constructors-4.1


sql/item_subselect.cc:
  Auto merged
sql/item_subselect.h:
  Auto merged
parents 1fded9e1 d1ab51eb
......@@ -898,7 +898,7 @@ int ha_myisam::index_read(byte * buf, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
statistic_increment(ha_read_key_count,&LOCK_status);
int error=mi_rkey(file,buf,active_index, key, key_len, (enum ha_rkey_function)find_flag);
int error=mi_rkey(file,buf,active_index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
......@@ -907,7 +907,7 @@ int ha_myisam::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
statistic_increment(ha_read_key_count,&LOCK_status);
int error=mi_rkey(file,buf,index, key, key_len, (enum ha_rkey_function)find_flag);
int error=mi_rkey(file,buf,index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
......
......@@ -36,7 +36,7 @@ inline Item * and_items(Item* cond, Item *item)
Item_subselect::Item_subselect():
Item_result_field(), engine_owner(1), value_assigned(0), substitution(0),
have_to_be_excluded(0), engine_changed(0)
engine(0), have_to_be_excluded(0), engine_changed(0)
{
reset();
/*
......@@ -46,7 +46,8 @@ Item_subselect::Item_subselect():
null_value= 1;
}
void Item_subselect::init(THD *thd, st_select_lex *select_lex,
void Item_subselect::init(st_select_lex *select_lex,
select_subselect *result)
{
......@@ -54,14 +55,14 @@ void Item_subselect::init(THD *thd, st_select_lex *select_lex,
DBUG_PRINT("subs", ("select_lex 0x%xl", (ulong) select_lex));
if (select_lex->next_select())
engine= new subselect_union_engine(thd, select_lex->master_unit(), result,
engine= new subselect_union_engine(select_lex->master_unit(), result,
this);
else
engine= new subselect_single_select_engine(thd, select_lex, result,
this);
engine= new subselect_single_select_engine(select_lex, result, this);
DBUG_VOID_RETURN;
}
Item_subselect::~Item_subselect()
{
if (engine_owner)
......@@ -78,7 +79,7 @@ Item_subselect::select_transformer(JOIN *join)
bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
{
thd= thd_param;
engine->set_thd((thd= thd_param));
char const *save_where= thd->where;
int res= engine->prepare();
......@@ -151,25 +152,23 @@ inline table_map Item_subselect::used_tables() const
(engine->uncacheable() ? RAND_TABLE_BIT : 0L));
}
Item_singlerow_subselect::Item_singlerow_subselect(THD *thd,
st_select_lex *select_lex)
Item_singlerow_subselect::Item_singlerow_subselect(st_select_lex *select_lex)
:Item_subselect(), value(0)
{
DBUG_ENTER("Item_singlerow_subselect::Item_singlerow_subselect");
init(thd, select_lex, new select_singlerow_subselect(this));
init(select_lex, new select_singlerow_subselect(this));
max_columns= 1;
maybe_null= 1;
max_columns= UINT_MAX;
DBUG_VOID_RETURN;
}
Item_maxmin_subselect::Item_maxmin_subselect(THD *thd,
st_select_lex *select_lex,
Item_maxmin_subselect::Item_maxmin_subselect(st_select_lex *select_lex,
bool max)
:Item_singlerow_subselect()
{
DBUG_ENTER("Item_maxmin_subselect::Item_maxmin_subselect");
init(thd, select_lex, new select_max_min_finder_subselect(this, max));
init(select_lex, new select_max_min_finder_subselect(this, max));
max_columns= 1;
maybe_null= 1;
max_columns= 1;
......@@ -338,12 +337,11 @@ String *Item_singlerow_subselect::val_str (String *str)
}
}
Item_exists_subselect::Item_exists_subselect(THD *thd,
st_select_lex *select_lex):
Item_exists_subselect::Item_exists_subselect(st_select_lex *select_lex):
Item_subselect()
{
DBUG_ENTER("Item_exists_subselect::Item_exists_subselect");
init(thd, select_lex, new select_exists_subselect(this));
init(select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX;
null_value= 0; //can't be NULL
maybe_null= 0; //can't be NULL
......@@ -368,13 +366,13 @@ bool Item_in_subselect::test_limit(SELECT_LEX_UNIT *unit)
return(0);
}
Item_in_subselect::Item_in_subselect(THD *thd, Item * left_exp,
Item_in_subselect::Item_in_subselect(Item * left_exp,
st_select_lex *select_lex):
Item_exists_subselect(), upper_not(0)
{
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
left_expr= left_exp;
init(thd, select_lex, new select_exists_subselect(this));
init(select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX;
maybe_null= 1;
abort_on_null= 0;
......@@ -384,7 +382,7 @@ Item_in_subselect::Item_in_subselect(THD *thd, Item * left_exp,
DBUG_VOID_RETURN;
}
Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp,
Item_allany_subselect::Item_allany_subselect(Item * left_exp,
compare_func_creator fn,
st_select_lex *select_lex)
:Item_in_subselect()
......@@ -392,7 +390,7 @@ Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp,
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
left_expr= left_exp;
func= fn;
init(thd, select_lex, new select_exists_subselect(this));
init(select_lex, new select_exists_subselect(this));
max_columns= 1;
abort_on_null= 0;
reset();
......@@ -534,14 +532,14 @@ Item_in_subselect::single_value_transformer(JOIN *join,
{
DBUG_RETURN(RES_ERROR);
}
subs= new Item_singlerow_subselect(thd, select_lex);
subs= new Item_singlerow_subselect(select_lex);
}
else
{
// remove LIMIT placed by ALL/ANY subquery
select_lex->master_unit()->global_parameters->select_limit=
HA_POS_ERROR;
subs= new Item_maxmin_subselect(thd, select_lex,
subs= new Item_maxmin_subselect(select_lex,
(func == &Item_bool_func2::le_creator ||
func == &Item_bool_func2::lt_creator));
}
......@@ -756,6 +754,7 @@ Item_in_subselect::row_value_transformer(JOIN *join,
DBUG_RETURN(RES_OK);
}
Item_subselect::trans_res
Item_in_subselect::select_transformer(JOIN *join)
{
......@@ -765,6 +764,7 @@ Item_in_subselect::select_transformer(JOIN *join)
return row_value_transformer(join, left_expr);
}
Item_subselect::trans_res
Item_allany_subselect::select_transformer(JOIN *join)
{
......@@ -772,12 +772,11 @@ Item_allany_subselect::select_transformer(JOIN *join)
}
subselect_single_select_engine::
subselect_single_select_engine(THD *thd,
st_select_lex *select,
select_subselect *result,
Item_subselect *item):
subselect_engine(thd, item, result),
prepared(0), optimized(0), executed(0)
subselect_single_select_engine(st_select_lex *select,
select_subselect *result,
Item_subselect *item)
:subselect_engine(item, result),
prepared(0), optimized(0), executed(0), join(0)
{
select_lex= select;
SELECT_LEX_UNIT *unit= select_lex->master_unit();
......@@ -788,24 +787,20 @@ subselect_single_select_engine::
unit->select_limit_cnt= HA_POS_ERROR; // no limit
if (unit->select_limit_cnt == HA_POS_ERROR)
select_lex->options&= ~OPTION_FOUND_ROWS;
join= new JOIN(thd, select_lex->item_list, select_lex->options, result);
if (!join || !result)
//out of memory
thd->fatal_error();
unit->item= item;
this->select_lex= select_lex;
}
subselect_union_engine::subselect_union_engine(THD *thd,
st_select_lex_unit *u,
subselect_union_engine::subselect_union_engine(st_select_lex_unit *u,
select_subselect *result,
Item_subselect *item):
subselect_engine(thd, item, result)
Item_subselect *item)
:subselect_engine(item, result)
{
unit= u;
if (!result)
//out of memory
thd->fatal_error();
current_thd->fatal_error();
unit->item= item;
}
......@@ -813,6 +808,13 @@ int subselect_single_select_engine::prepare()
{
if (prepared)
return 0;
join= new JOIN(thd, select_lex->item_list, select_lex->options, result);
if (!join || !result)
{
//out of memory
thd->fatal_error();
return 1;
}
prepared= 1;
SELECT_LEX *save_select= thd->lex.current_select;
thd->lex.current_select= select_lex;
......@@ -983,6 +985,7 @@ int subselect_union_engine::exec()
return res;
}
int subselect_uniquesubquery_engine::exec()
{
DBUG_ENTER("subselect_uniquesubquery_engine::exec");
......@@ -1004,34 +1007,22 @@ int subselect_uniquesubquery_engine::exec()
{
error= 0;
table->null_row= 0;
if (table->status)
((Item_in_subselect *) item)->value= 0;
else
((Item_in_subselect *) item)->value= (!cond || cond->val_int()?1:0);
((Item_in_subselect *) item)->value= (!table->status &&
(!cond || cond->val_int()) ? 1 :
0);
}
}
DBUG_RETURN(end_exec(table) || (error != 0));
DBUG_RETURN(error != 0);
}
int subselect_uniquesubquery_engine::end_exec(TABLE *table)
subselect_uniquesubquery_engine::~subselect_uniquesubquery_engine()
{
DBUG_ENTER("subselect_uniquesubquery_engine::end_exec");
int error=0, tmp;
if ((tmp= table->file->extra(HA_EXTRA_NO_CACHE)))
{
DBUG_PRINT("error", ("extra(HA_EXTRA_NO_CACHE) failed"));
error= 1;
}
if ((tmp= table->file->index_end()))
{
DBUG_PRINT("error", ("index_end() failed"));
error= 1;
}
if (error == 1)
table->file->print_error(tmp, MYF(0));
DBUG_RETURN(error != 0);
/* Tell handler we don't need the index anymore */
tab->table->file->index_end();
}
int subselect_indexsubquery_engine::exec()
{
DBUG_ENTER("subselect_indexsubselect_engine::exec");
......@@ -1040,9 +1031,11 @@ int subselect_indexsubquery_engine::exec()
TABLE *table= tab->table;
((Item_in_subselect *) item)->value= 0;
if (check_null)
{
*tab->null_ref_key= 0;
/* We need to check for NULL if there wasn't a matching value */
*tab->null_ref_key= 0; // Search first for not null
((Item_in_subselect *) item)->was_null= 0;
}
......@@ -1060,7 +1053,7 @@ int subselect_indexsubquery_engine::exec()
error= report_error(table, error);
else
{
for(;;)
for (;;)
{
error= 0;
table->null_row= 0;
......@@ -1072,7 +1065,7 @@ int subselect_indexsubquery_engine::exec()
((Item_in_subselect *) item)->was_null= 1;
else
((Item_in_subselect *) item)->value= 1;
goto finish;
break;
}
error= table->file->index_next_same(table->record[0],
tab->ref.key_buff,
......@@ -1080,25 +1073,26 @@ int subselect_indexsubquery_engine::exec()
if (error && error != HA_ERR_END_OF_FILE)
{
error= report_error(table, error);
goto finish;
break;
}
}
else
{
if (!check_null || null_finding)
goto finish;
break; /* We don't need to check nulls */
*tab->null_ref_key= 1;
null_finding= 1;
if (safe_index_read(tab))
goto finish;
/* Check if there exists a row with a null value in the index */
if ((error= (safe_index_read(tab) == 1)))
break;
}
}
}
}
finish:
DBUG_RETURN(end_exec(table) || (error != 0));
DBUG_RETURN(error != 0);
}
uint subselect_single_select_engine::cols()
{
return select_lex->item_list.elements;
......
......@@ -64,7 +64,7 @@ public:
pointer in constructor initialization list, but we need pass pointer
to subselect Item class to select_subselect classes constructor.
*/
virtual void init (THD *thd, st_select_lex *select_lex,
virtual void init (st_select_lex *select_lex,
select_subselect *result);
~Item_subselect();
......@@ -111,7 +111,7 @@ class Item_singlerow_subselect :public Item_subselect
protected:
Item_cache *value, **row;
public:
Item_singlerow_subselect(THD *thd, st_select_lex *select_lex);
Item_singlerow_subselect(st_select_lex *select_lex);
Item_singlerow_subselect() :Item_subselect(), value(0), row (0) {}
subs_type substype() { return SINGLEROW_SUBS; }
......@@ -139,7 +139,7 @@ public:
class Item_maxmin_subselect: public Item_singlerow_subselect
{
public:
Item_maxmin_subselect(THD *thd, st_select_lex *select_lex, bool max);
Item_maxmin_subselect(st_select_lex *select_lex, bool max);
};
/* exists subselect */
......@@ -150,7 +150,7 @@ protected:
longlong value; /* value of this item (boolean: exists/not-exists) */
public:
Item_exists_subselect(THD *thd, st_select_lex *select_lex);
Item_exists_subselect(st_select_lex *select_lex);
Item_exists_subselect(): Item_subselect() {}
subs_type substype() { return EXISTS_SUBS; }
......@@ -187,7 +187,7 @@ protected:
public:
Item_func_not_all *upper_not; // point on NOT before ALL subquery
Item_in_subselect(THD *thd, Item * left_expr, st_select_lex *select_lex);
Item_in_subselect(Item * left_expr, st_select_lex *select_lex);
Item_in_subselect()
:Item_exists_subselect(), abort_on_null(0), upper_not(0) {}
......@@ -215,6 +215,7 @@ public:
friend class subselect_indexsubquery_engine;
};
/* ALL/ANY/SOME subselect */
class Item_allany_subselect :public Item_in_subselect
{
......@@ -222,7 +223,7 @@ protected:
compare_func_creator func;
public:
Item_allany_subselect(THD *thd, Item * left_expr, compare_func_creator f,
Item_allany_subselect(Item * left_expr, compare_func_creator f,
st_select_lex *select_lex);
// only ALL subquery has upper not
......@@ -230,6 +231,7 @@ public:
trans_res select_transformer(JOIN *join);
};
class subselect_engine: public Sql_alloc
{
protected:
......@@ -240,16 +242,19 @@ protected:
bool maybe_null; /* may be null (first item in select) */
public:
subselect_engine(THD *thd, Item_subselect *si, select_subselect *res)
subselect_engine(Item_subselect *si, select_subselect *res)
:thd(0)
{
result= res;
item= si;
this->thd= thd;
res_type= STRING_RESULT;
maybe_null= 0;
}
virtual ~subselect_engine() {}; // to satisfy compiler
// set_thd should be called before prepare()
void set_thd(THD *thd) { this->thd= thd; }
THD * get_thd() { return thd; }
virtual int prepare()= 0;
virtual void fix_length_and_dec(Item_cache** row)= 0;
virtual int exec()= 0;
......@@ -261,6 +266,7 @@ public:
bool may_be_null() { return maybe_null; };
};
class subselect_single_select_engine: public subselect_engine
{
my_bool prepared; /* simple subselect is prepared */
......@@ -269,7 +275,7 @@ class subselect_single_select_engine: public subselect_engine
st_select_lex *select_lex; /* corresponding select_lex */
JOIN * join; /* corresponding JOIN structure */
public:
subselect_single_select_engine(THD *thd, st_select_lex *select,
subselect_single_select_engine(st_select_lex *select,
select_subselect *result,
Item_subselect *item);
int prepare();
......@@ -281,12 +287,12 @@ public:
void exclude();
};
class subselect_union_engine: public subselect_engine
{
st_select_lex_unit *unit; /* corresponding unit structure */
public:
subselect_union_engine(THD *thd,
st_select_lex_unit *u,
subselect_union_engine(st_select_lex_unit *u,
select_subselect *result,
Item_subselect *item);
int prepare();
......@@ -298,6 +304,7 @@ public:
void exclude();
};
struct st_join_table;
class subselect_uniquesubquery_engine: public subselect_engine
{
......@@ -306,25 +313,30 @@ protected:
Item *cond;
public:
// constructor can assign THD because it will be called after JOIN::prepare
subselect_uniquesubquery_engine(THD *thd, st_join_table *tab_arg,
Item_subselect *subs, Item *where)
:subselect_engine(thd, subs, 0), tab(tab_arg), cond(where)
{}
:subselect_engine(subs, 0), tab(tab_arg), cond(where)
{
set_thd(thd);
}
~subselect_uniquesubquery_engine();
int prepare();
void fix_length_and_dec(Item_cache** row);
int exec();
uint cols() { return 1; }
bool dependent() { return 1; }
bool uncacheable() { return 1; }
void exclude();
static int end_exec(TABLE *table);
void exclude();
};
class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine
{
bool check_null;
public:
// constructor can assign THD because it will be called after JOIN::prepare
subselect_indexsubquery_engine(THD *thd, st_join_table *tab_arg,
Item_subselect *subs, Item *where,
bool chk_null)
......
......@@ -1564,7 +1564,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
VOID(pthread_mutex_unlock(&LOCK_log));
return 0;
}
if ((specialflag & SPECIAL_LONG_LOG_FORMAT) || query_start_arg)
if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT) || query_start_arg)
{
current_time=time(NULL);
if (current_time != last_time)
......@@ -1617,7 +1617,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
// Save value if we do an insert.
if (thd->insert_id_used)
{
if (specialflag & SPECIAL_LONG_LOG_FORMAT)
if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT))
{
end=strmov(end,",insert_id=");
end=longlong10_to_str((longlong) thd->last_insert_id,end,-10);
......
......@@ -262,6 +262,8 @@ my_bool opt_log_slave_updates= 0;
my_bool opt_console= 0, opt_bdb, opt_innodb, opt_isam;
my_bool opt_readonly, use_temp_pool, relay_log_purge;
my_bool opt_secure_auth= 0;
my_bool opt_short_log_format= 0;
my_bool opt_log_queries_not_using_indexes= 0;
volatile bool mqh_used = 0;
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
......@@ -3455,7 +3457,7 @@ enum options
OPT_SKIP_PRIOR, OPT_BIG_TABLES,
OPT_STANDALONE, OPT_ONE_THREAD,
OPT_CONSOLE, OPT_LOW_PRIORITY_UPDATES,
OPT_SKIP_HOST_CACHE, OPT_LONG_FORMAT,
OPT_SKIP_HOST_CACHE, OPT_SHORT_LOG_FORMAT,
OPT_FLUSH, OPT_SAFE,
OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB,
OPT_TABLE_TYPE, OPT_INIT_FILE,
......@@ -3562,7 +3564,8 @@ enum options
OPT_DEFAULT_WEEK_FORMAT,
OPT_GROUP_CONCAT_MAX_LEN,
OPT_DEFAULT_COLLATION,
OPT_SECURE_AUTH
OPT_SECURE_AUTH,
OPT_LOG_QUERIES_NOT_USING_INDEXES
};
......@@ -3769,9 +3772,17 @@ Disable with --skip-bdb (will save memory).",
"Log slow queries to this log file. Defaults logging to hostname-slow.log file.",
(gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"log-long-format", OPT_LONG_FORMAT,
"Log some extra information to update log.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"log-long-format", '0',
"Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-short-format", OPT_SHORT_LOG_FORMAT,
"Don't log extra information to update and slow-query logs.",
(gptr*) &opt_short_log_format, (gptr*) &opt_short_log_format,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
"Log queries that are executed without benefit of any index.",
(gptr*) &opt_log_queries_not_using_indexes, (gptr*) &opt_log_queries_not_using_indexes,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
"Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.",
(gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL,
......@@ -5166,9 +5177,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case (int) OPT_SKIP_RESOLVE:
opt_specialflag|=SPECIAL_NO_RESOLVE;
break;
case (int) OPT_LONG_FORMAT:
opt_specialflag|=SPECIAL_LONG_LOG_FORMAT;
break;
case (int) OPT_SKIP_NETWORKING:
opt_disable_networking=1;
mysqld_port=0;
......@@ -5508,6 +5516,10 @@ static void get_options(int argc,char **argv)
keybuff_size= (((KEY_CACHE *) find_named(&key_caches, "default", 7,
&not_used))->size);
}
if (opt_short_log_format)
opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT;
if (opt_log_queries_not_using_indexes)
opt_specialflag|= SPECIAL_LOG_QUERIES_NOT_USING_INDEXES;
}
......@@ -5622,14 +5634,16 @@ static uint set_maximum_open_files(uint max_file_limit)
rlimit.rlim_cur=rlimit.rlim_max=max_file_limit;
if (setrlimit(RLIMIT_NOFILE,&rlimit))
{
sql_print_error("Warning: setrlimit couldn't increase number of open files to more than %lu (request: %u)",
old_cur, max_file_limit); /* purecov: inspected */
if (global_system_variables.log_warnings)
sql_print_error("Warning: setrlimit couldn't increase number of open files to more than %lu (request: %u)",
old_cur, max_file_limit); /* purecov: inspected */
max_file_limit=old_cur;
}
else
{
(void) getrlimit(RLIMIT_NOFILE,&rlimit);
if ((uint) rlimit.rlim_cur != max_file_limit)
if ((uint) rlimit.rlim_cur != max_file_limit &&
global_system_variables.log_warnings)
sql_print_error("Warning: setrlimit returned ok, but didn't change limits. Max open files is %ld (request: %u)",
(ulong) rlimit.rlim_cur,
max_file_limit); /* purecov: inspected */
......
......@@ -1566,7 +1566,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->variables.long_query_time ||
((thd->lex.select_lex.options &
(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED)) &&
(specialflag & SPECIAL_LONG_LOG_FORMAT)))
(specialflag & SPECIAL_LOG_QUERIES_NOT_USING_INDEXES)))
{
long_query_count++;
mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query);
......
......@@ -6661,7 +6661,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
usable_keys=0;
break;
}
usable_keys&=((Item_field*) (*tmp_order->item))->field->part_of_sortkey;
if (!(usable_keys&= (((Item_field*) (*tmp_order->item))->field->
part_of_sortkey)))
break; // No usable keys
}
ref_key= -1;
......
......@@ -2238,10 +2238,10 @@ expr_expr:
| expr NOT IN_SYM '(' expr_list ')'
{ $5->push_front($1); $$= new Item_func_not(new Item_func_in(*$5)); }
| expr IN_SYM in_subselect
{ $$= new Item_in_subselect(YYTHD, $1, $3); }
{ $$= new Item_in_subselect($1, $3); }
| expr NOT IN_SYM in_subselect
{
$$= new Item_func_not(new Item_in_subselect(YYTHD, $1, $4));
$$= new Item_func_not(new Item_in_subselect($1, $4));
}
| expr BETWEEN_SYM no_and_expr AND expr
{ $$= new Item_func_between($1,$3,$5); }
......@@ -2263,7 +2263,7 @@ expr_expr:
| expr comp_op all_or_any in_subselect %prec EQ
{
Item_allany_subselect *it=
new Item_allany_subselect(YYTHD, $1, (*$2)($3), $4);
new Item_allany_subselect($1, (*$2)($3), $4);
if ($3)
$$ = it->upper_not= new Item_func_not_all(it); /* ALL */
else
......@@ -2309,7 +2309,7 @@ no_in_expr:
| no_in_expr comp_op all_or_any in_subselect %prec EQ
{
Item_allany_subselect *it=
new Item_allany_subselect(YYTHD, $1, (*$2)($3), $4);
new Item_allany_subselect($1, (*$2)($3), $4);
if ($3)
$$ = it->upper_not= new Item_func_not_all(it); /* ALL */
else
......@@ -2340,10 +2340,10 @@ no_and_expr:
| no_and_expr NOT IN_SYM '(' expr_list ')'
{ $5->push_front($1); $$= new Item_func_not(new Item_func_in(*$5)); }
| no_and_expr IN_SYM in_subselect
{ $$= new Item_in_subselect(YYTHD, $1, $3); }
{ $$= new Item_in_subselect($1, $3); }
| no_and_expr NOT IN_SYM in_subselect
{
$$= new Item_func_not(new Item_in_subselect(YYTHD, $1, $4));
$$= new Item_func_not(new Item_in_subselect($1, $4));
}
| no_and_expr BETWEEN_SYM no_and_expr AND expr
{ $$= new Item_func_between($1,$3,$5); }
......@@ -2364,7 +2364,7 @@ no_and_expr:
| no_and_expr comp_op all_or_any in_subselect %prec EQ
{
Item_allany_subselect *it=
new Item_allany_subselect(YYTHD, $1, (*$2)($3), $4);
new Item_allany_subselect($1, (*$2)($3), $4);
if ($3)
$$ = it->upper_not= new Item_func_not_all(it); /* ALL */
else
......@@ -5356,9 +5356,8 @@ singlerow_subselect:
singlerow_subselect_init:
select_init2
{
$$= new Item_singlerow_subselect(YYTHD,
Lex->current_select->master_unit()->
first_select());
$$= new Item_singlerow_subselect(Lex->current_select->
master_unit()->first_select());
};
exists_subselect:
......@@ -5371,9 +5370,8 @@ exists_subselect:
exists_subselect_init:
select_init2
{
$$= new Item_exists_subselect(YYTHD,
Lex->current_select->master_unit()->
first_select());
$$= new Item_exists_subselect(Lex->current_select->master_unit()->
first_select());
};
in_subselect:
......
......@@ -107,8 +107,9 @@
#define SPECIAL_NO_PRIOR 128 /* Don't prioritize threads */
#define SPECIAL_BIG_SELECTS 256 /* Don't use heap tables */
#define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */
#define SPECIAL_LONG_LOG_FORMAT 1024
#define SPECIAL_SHORT_LOG_FORMAT 1024
#define SPECIAL_SAFE_MODE 2048
#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Log q not using indexes */
/* Extern defines */
#define store_record(A,B) bmove_align((A)->B,(A)->record[0],(size_t) (A)->reclength)
......
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