summaryrefslogtreecommitdiff
path: root/sql/sql_union.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
commit5a331b9e4e6f46a390b179730bca747a507bd87f (patch)
treee5a58d3f07e9cca109d78031822106ff2be7f6f8 /sql/sql_union.cc
parent1362acab293a929fe58ec8591ca4ad51898148f5 (diff)
downloadmariadb-git-5a331b9e4e6f46a390b179730bca747a507bd87f.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/sql_union.cc')
-rw-r--r--sql/sql_union.cc55
1 files changed, 27 insertions, 28 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 56713e42244..f2470a59944 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -106,9 +106,9 @@ bool select_union::flush()
}
-int st_select_lex_unit::prepare(THD *thd, select_result *sel_result)
+int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result)
{
- SELECT_LEX *lex_select_save= thd->lex.current_select;
+ SELECT_LEX *lex_select_save= thd_arg->lex.current_select;
SELECT_LEX *sl, *first_select;
select_result *tmp_result;
DBUG_ENTER("st_select_lex_unit::prepare");
@@ -123,10 +123,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result)
DBUG_RETURN(0);
prepared= 1;
res= 0;
- TMP_TABLE_PARAM tmp_table_param;
- bzero((char *)&tmp_table_param,sizeof(TMP_TABLE_PARAM));
- thd->lex.current_select= sl= first_select= first_select_in_union();
+ thd_arg->lex.current_select= sl= first_select= first_select_in_union();
found_rows_for_union= first_select->options & OPTION_FOUND_ROWS;
/* Global option */
@@ -136,7 +134,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result)
if (!(tmp_result= union_result= new select_union(0)))
goto err;
union_result->not_describe= 1;
- union_result->tmp_table_param= tmp_table_param;
+ union_result->tmp_table_param.init();
}
else
{
@@ -147,10 +145,10 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result)
for (;sl; sl= sl->next_select())
{
- JOIN *join= new JOIN(thd, sl->item_list,
- sl->options | thd->options | SELECT_NO_UNLOCK,
+ JOIN *join= new JOIN(thd_arg, sl->item_list,
+ sl->options | thd_arg->options | SELECT_NO_UNLOCK,
tmp_result);
- thd->lex.current_select= sl;
+ thd_arg->lex.current_select= sl;
offset_limit_cnt= sl->offset_limit;
select_limit_cnt= sl->select_limit+sl->offset_limit;
if (select_limit_cnt < sl->select_limit)
@@ -169,19 +167,19 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result)
sl->having,
(ORDER*) NULL,
sl, this);
- if (res || thd->is_fatal_error)
+ if (res || thd_arg->is_fatal_error)
goto err;
if (sl == first_select)
{
types.empty();
List_iterator_fast<Item> it(sl->item_list);
- Item *item;
- while((item= it++))
+ Item *item_tmp;
+ while ((item_tmp= it++))
{
- types.push_back(new Item_type_holder(thd, item));
+ types.push_back(new Item_type_holder(thd_arg, item_tmp));
}
- if (thd->is_fatal_error)
+ if (thd_arg->is_fatal_error)
goto err; // out of memory
}
else
@@ -194,10 +192,10 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result)
}
List_iterator_fast<Item> it(sl->item_list);
List_iterator_fast<Item> tp(types);
- Item *type, *item;
- while((type= tp++, item= it++))
+ Item *type, *item_tmp;
+ while ((type= tp++, item_tmp= it++))
{
- if (((Item_type_holder*)type)->join_types(thd, item))
+ if (((Item_type_holder*)type)->join_types(thd_arg, item_tmp))
DBUG_RETURN(-1);
}
}
@@ -205,11 +203,12 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result)
if (first_select->next_select())
{
- tmp_table_param.field_count= types.elements;
- if (!(table= create_tmp_table(thd, &tmp_table_param, types,
+ union_result->tmp_table_param.field_count= types.elements;
+ if (!(table= create_tmp_table(thd_arg,
+ &union_result->tmp_table_param, types,
(ORDER*) 0, !union_option, 1,
(first_select_in_union()->options |
- thd->options |
+ thd_arg->options |
TMP_TABLE_ALL_COLUMNS),
HA_POS_ERROR, (char*) "")))
goto err;
@@ -222,7 +221,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result)
union_result->set_table(table);
item_list.empty();
- thd->lex.current_select= lex_select_save;
+ thd_arg->lex.current_select= lex_select_save;
{
Field **field;
for (field= table->field; *field; field++)
@@ -235,12 +234,12 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result)
else
first_select->braces= 0; // remove our changes
- thd->lex.current_select= lex_select_save;
+ thd_arg->lex.current_select= lex_select_save;
- DBUG_RETURN(res || thd->is_fatal_error ? 1 : 0);
+ DBUG_RETURN(res || thd_arg->is_fatal_error ? 1 : 0);
err:
- thd->lex.current_select= lex_select_save;
+ thd_arg->lex.current_select= lex_select_save;
DBUG_RETURN(-1);
}
@@ -375,7 +374,7 @@ int st_select_lex_unit::exec()
if (!thd->is_fatal_error) // Check if EOM
{
- ulong options= thd->options;
+ ulong options_tmp= thd->options;
thd->lex.current_select= fake_select_lex;
offset_limit_cnt= global_parameters->offset_limit;
select_limit_cnt= global_parameters->select_limit +
@@ -384,9 +383,9 @@ int st_select_lex_unit::exec()
if (select_limit_cnt < global_parameters->select_limit)
select_limit_cnt= HA_POS_ERROR; // no limit
if (select_limit_cnt == HA_POS_ERROR)
- options&= ~OPTION_FOUND_ROWS;
+ options_tmp&= ~OPTION_FOUND_ROWS;
else if (found_rows_for_union && !thd->lex.describe)
- options|= OPTION_FOUND_ROWS;
+ options_tmp|= OPTION_FOUND_ROWS;
fake_select_lex->ftfunc_list= &empty_list;
fake_select_lex->table_list.link_in_list((byte *)&result_table_list,
(byte **)
@@ -421,7 +420,7 @@ int st_select_lex_unit::exec()
global_parameters->order_list.elements,
(ORDER*)global_parameters->order_list.first,
(ORDER*) NULL, NULL, (ORDER*) NULL,
- options | SELECT_NO_UNLOCK,
+ options_tmp | SELECT_NO_UNLOCK,
result, this, fake_select_lex);
if (!res)
thd->limit_found_rows = (ulonglong)table->file->records + add_rows;