summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2003-11-28 12:18:13 +0200
committerunknown <monty@mysql.com>2003-11-28 12:18:13 +0200
commit76bf7d2224287b40ecfd2bac62b2dd45561affb1 (patch)
treee5a58d3f07e9cca109d78031822106ff2be7f6f8 /sql/item_subselect.cc
parent292cb97e964f95498396555d27bee1ef707b8797 (diff)
downloadmariadb-git-76bf7d2224287b40ecfd2bac62b2dd45561affb1.tar.gz
Added missing SSL library (Should be in source distribution)
Fixed compiler warnings (a lot of hidden variables detected by the Forte compiler) Added a lot of 'version_xxx' strings to 'show variables' Prevent copying of TMP_TABLE_PARAM (This caused core dump bug on Solaris) Fixed problem with printing sub selects to debug log Docs/mysqld_error.txt: Updated error messages Makefile.am: Added missing SSL library (Should be in source distribution) configure.in: Added missing SSL library include/sql_common.h: Move duplicated prototypes innobase/os/os0file.c: Added comment for line that could be removed innobase/srv/srv0srv.c: Added comment for line that could be removed innobase/srv/srv0start.c: Added comment for line that could be removed innobase/trx/trx0sys.c: Added cast to remove compiler warning isam/isamchk.c: Fixed compiler warning libmysql/conf_to_src.c: Include files in proper order myisam/mi_check.c: Removed else part that caused compiler warning myisam/mi_delete.c: Added cast myisam/mi_page.c: Added cast myisam/mi_preload.c: Added cast myisam/mi_write.c: Added cast myisam/myisampack.c: changed 'byte' to 'current_byte' to avoid compiler warnings mysql-test/mysql-test-run.sh: Removed start-from as test '<' is not portable and this can easily be done from command line mysys/hash.c: Added cast mysys/mf_wcomp.c: Removed not reached line mysys/my_append.c: Fixed include file order to get this more portable mysys/my_copy.c: Fixed include file order to get this more portable mysys/my_redel.c: Fixed include file order to get this more portable sql-common/client.c: More DBUG_PRINT sql-common/pack.c: Added casts becasue Fortre compiler apparently compares (ulonglong) < (longlong) as signed sql/ha_heap.cc: Changed variable names to not cause hidden variables sql/ha_innodb.cc: Changed variable names to not cause hidden variables sql/item.cc: Changed variable names to not cause hidden variables sql/item.h: Changed variable names to not cause hidden variables sql/item_cmpfunc.h: Changed variable names to not cause hidden variables sql/item_func.cc: Changed variable names to not cause hidden variables sql/item_subselect.cc: Changed variable names to not cause hidden variables sql/item_subselect.h: Changed variable names to not cause hidden variables sql/item_sum.cc: Changed variable names to not cause hidden variables sql/item_timefunc.cc: Changed variable names to not cause hidden variables sql/log.cc: Changed variable names to not cause hidden variables sql/protocol.cc: Changed variable names to not cause hidden variables sql/protocol.h: Changed variable names to not cause hidden variables Remove function not declared in protocol.cc sql/protocol_cursor.cc: Changed variable names to not cause hidden variables sql/set_var.cc: Added a lot of 'version_xxx' strings Changed 'bdb_version' to 'version_bdb' sql/sql_class.cc: Changed variable names to not cause hidden variables Add TMP_TABLE_PARAM::init() to allow one to initialize structure several times sql/sql_class.h: Prevent copying of TMP_TABLE_PARAM (This caused core dump bug on Solaris) sql/sql_derived.cc: Avoid copying TMP_TABLE_PARAM (Use class version instead) sql/sql_error.cc: More DBUG sql/sql_help.cc: Fixed compiler warning sql/sql_lex.cc: Changed variable names to not cause hidden variables sql/sql_list.h: Changed variable names to not cause hidden variables sql/sql_parse.cc: Changed variable names to not cause hidden variables sql/sql_select.cc: Changed variable names to not cause hidden variables Ensure that you don't send NULL to printf() for %s Fixed problem with printing sub selects to debug log sql/sql_select.h: Changed variable names to not cause hidden variables sql/sql_union.cc: Changed variable names to not cause hidden variables Don't use local copy of TMP_TABLE_PARAM (Caused core dump on Solaris) sql/sql_update.cc: Indentation cleanup sql/sql_yacc.yy: Remove warning strings/conf_to_src.c: Fixed include file order
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc81
1 files changed, 41 insertions, 40 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 367400d6b0b..7b401b50d4c 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -306,8 +306,7 @@ void Item_singlerow_subselect::fix_length_and_dec()
}
else
{
- THD *thd= current_thd;
- if (!(row= (Item_cache**)thd->alloc(sizeof(Item_cache*)*max_columns)))
+ if (!(row= (Item_cache**) sql_alloc(sizeof(Item_cache*)*max_columns)))
return;
engine->fix_length_and_dec(row);
value= *row;
@@ -550,8 +549,8 @@ Item_in_subselect::single_value_transformer(JOIN *join,
SELECT_LEX *select_lex= join->select_lex;
- THD *thd= join->thd;
- thd->where= "scalar IN/ALL/ANY subquery";
+ THD *thd_tmp= join->thd;
+ thd_tmp->where= "scalar IN/ALL/ANY subquery";
if (select_lex->item_list.elements > 1)
{
@@ -595,7 +594,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
select_lex->item_list.empty();
select_lex->item_list.push_back(item);
- if (item->fix_fields(thd, join->tables_list, &item))
+ if (item->fix_fields(thd_tmp, join->tables_list, &item))
{
DBUG_RETURN(RES_ERROR);
}
@@ -609,14 +608,14 @@ Item_in_subselect::single_value_transformer(JOIN *join,
subs= new Item_maxmin_subselect(this, select_lex, func->l_op());
}
// left expression belong to outer select
- SELECT_LEX *current= thd->lex.current_select, *up;
- thd->lex.current_select= up= current->return_after_parsing();
- if (left_expr->fix_fields(thd, up->get_table_list(), &left_expr))
+ SELECT_LEX *current= thd_tmp->lex.current_select, *up;
+ thd_tmp->lex.current_select= up= current->return_after_parsing();
+ if (left_expr->fix_fields(thd_tmp, up->get_table_list(), &left_expr))
{
- thd->lex.current_select= current;
+ thd_tmp->lex.current_select= current;
DBUG_RETURN(RES_ERROR);
}
- thd->lex.current_select= current;
+ thd_tmp->lex.current_select= current;
substitution= func->create(left_expr, subs);
DBUG_RETURN(RES_OK);
}
@@ -627,16 +626,16 @@ Item_in_subselect::single_value_transformer(JOIN *join,
SELECT_LEX_UNIT *unit= select_lex->master_unit();
substitution= optimizer= new Item_in_optimizer(left_expr, this);
- SELECT_LEX *current= thd->lex.current_select, *up;
+ SELECT_LEX *current= thd_tmp->lex.current_select, *up;
- thd->lex.current_select= up= current->return_after_parsing();
+ thd_tmp->lex.current_select= up= current->return_after_parsing();
//optimizer never use Item **ref => we can pass 0 as parameter
- if (!optimizer || optimizer->fix_left(thd, up->get_table_list(), 0))
+ if (!optimizer || optimizer->fix_left(thd_tmp, up->get_table_list(), 0))
{
- thd->lex.current_select= current;
+ thd_tmp->lex.current_select= current;
DBUG_RETURN(RES_ERROR);
}
- thd->lex.current_select= current;
+ thd_tmp->lex.current_select= current;
/*
As far as Item_ref_in_optimizer do not substitude itself on fix_fields
@@ -664,7 +663,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
this->full_name()));
join->having= and_items(join->having, item);
select_lex->having_fix_field= 1;
- if (join->having->fix_fields(thd, join->tables_list, &join->having))
+ if (join->having->fix_fields(thd_tmp, join->tables_list, &join->having))
{
select_lex->having_fix_field= 0;
DBUG_RETURN(RES_ERROR);
@@ -688,7 +687,8 @@ Item_in_subselect::single_value_transformer(JOIN *join,
new Item_cond_and(having, join->having) :
having);
select_lex->having_fix_field= 1;
- if (join->having->fix_fields(thd, join->tables_list, &join->having))
+ if (join->having->fix_fields(thd_tmp, join->tables_list,
+ &join->having))
{
select_lex->having_fix_field= 0;
DBUG_RETURN(RES_ERROR);
@@ -699,7 +699,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
}
item->name= (char *)in_additional_cond;
join->conds= and_items(join->conds, item);
- if (join->conds->fix_fields(thd, join->tables_list, &join->conds))
+ if (join->conds->fix_fields(thd_tmp, join->tables_list, &join->conds))
DBUG_RETURN(RES_ERROR);
}
else
@@ -711,7 +711,8 @@ Item_in_subselect::single_value_transformer(JOIN *join,
(char *)"<no matter>",
(char *)"<result>"));
select_lex->having_fix_field= 1;
- if (join->having->fix_fields(thd, join->tables_list, &join->having))
+ if (join->having->fix_fields(thd_tmp, join->tables_list,
+ &join->having))
{
select_lex->having_fix_field= 0;
DBUG_RETURN(RES_ERROR);
@@ -725,11 +726,11 @@ Item_in_subselect::single_value_transformer(JOIN *join,
// fix_field of item will be done in time of substituting
substitution= item;
have_to_be_excluded= 1;
- if (thd->lex.describe)
+ if (thd_tmp->lex.describe)
{
char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number);
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ push_warning(thd_tmp, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_SELECT_REDUCED, warn_buff);
}
DBUG_RETURN(RES_REDUCE);
@@ -739,13 +740,14 @@ Item_in_subselect::single_value_transformer(JOIN *join,
DBUG_RETURN(RES_OK);
}
+
Item_subselect::trans_res
Item_in_subselect::row_value_transformer(JOIN *join)
{
DBUG_ENTER("Item_in_subselect::row_value_transformer");
- THD *thd= join->thd;
- thd->where= "row IN/ALL/ANY subquery";
+ THD *thd_tmp= join->thd;
+ thd_tmp->where= "row IN/ALL/ANY subquery";
SELECT_LEX *select_lex= join->select_lex;
@@ -761,22 +763,22 @@ Item_in_subselect::row_value_transformer(JOIN *join)
SELECT_LEX_UNIT *unit= select_lex->master_unit();
substitution= optimizer= new Item_in_optimizer(left_expr, this);
- SELECT_LEX *current= thd->lex.current_select, *up;
- thd->lex.current_select= up= current->return_after_parsing();
+ SELECT_LEX *current= thd_tmp->lex.current_select, *up;
+ thd_tmp->lex.current_select= up= current->return_after_parsing();
//optimizer never use Item **ref => we can pass 0 as parameter
- if (!optimizer || optimizer->fix_left(thd, up->get_table_list(), 0))
+ if (!optimizer || optimizer->fix_left(thd_tmp, up->get_table_list(), 0))
{
- thd->lex.current_select= current;
+ thd_tmp->lex.current_select= current;
DBUG_RETURN(RES_ERROR);
}
- thd->lex.current_select= current;
+ thd_tmp->lex.current_select= current;
unit->uncacheable|= UNCACHEABLE_DEPENDENT;
}
uint n= left_expr->cols();
select_lex->uncacheable|= UNCACHEABLE_DEPENDENT;
- select_lex->setup_ref_array(thd,
+ select_lex->setup_ref_array(thd_tmp,
select_lex->order_list.elements +
select_lex->group_list.elements);
Item *item= 0;
@@ -802,7 +804,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
{
join->having= and_items(join->having, item);
select_lex->having_fix_field= 1;
- if (join->having->fix_fields(thd, join->tables_list, &join->having))
+ if (join->having->fix_fields(thd_tmp, join->tables_list, &join->having))
{
select_lex->having_fix_field= 0;
DBUG_RETURN(RES_ERROR);
@@ -812,7 +814,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
else
{
join->conds= and_items(join->conds, item);
- if (join->conds->fix_fields(thd, join->tables_list, &join->having))
+ if (join->conds->fix_fields(thd_tmp, join->tables_list, &join->having))
DBUG_RETURN(RES_ERROR);
}
DBUG_RETURN(RES_OK);
@@ -880,7 +882,7 @@ subselect_single_select_engine(st_select_lex *select,
unit->select_limit_cnt= unit->global_parameters->select_limit+
unit->global_parameters ->offset_limit;
if (unit->select_limit_cnt < unit->global_parameters->select_limit)
- unit->select_limit_cnt= HA_POS_ERROR; // no limit
+ unit->select_limit_cnt= HA_POS_ERROR; // no limit
if (unit->select_limit_cnt == HA_POS_ERROR)
select_lex->options&= ~OPTION_FOUND_ROWS;
unit->item= item;
@@ -889,17 +891,17 @@ subselect_single_select_engine(st_select_lex *select,
subselect_union_engine::subselect_union_engine(st_select_lex_unit *u,
- select_subselect *result,
- Item_subselect *item)
- :subselect_engine(item, result)
+ select_subselect *result_arg,
+ Item_subselect *item_arg)
+ :subselect_engine(item_arg, result_arg)
{
unit= u;
- if (!result)
- //out of memory
+ if (!result_arg) //out of memory
current_thd->fatal_error();
- unit->item= item;
+ unit->item= item_arg;
}
+
int subselect_single_select_engine::prepare()
{
if (prepared)
@@ -907,8 +909,7 @@ int subselect_single_select_engine::prepare()
join= new JOIN(thd, select_lex->item_list, select_lex->options, result);
if (!join || !result)
{
- //out of memory
- thd->fatal_error();
+ thd->fatal_error(); //out of memory
return 1;
}
prepared= 1;