1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

fixed subselects with temporary tables (SCRUM)

fixed memory leacks


mysql-test/r/subselect.result:
  some changes in subselect tests
mysql-test/t/subselect.test:
  some changes in subselect tests
sql/item.cc:
  some item made copyable
  methods for creating copy of item list
  tmp_table_field() splited
sql/item.h:
  some item made copyable
  methods for creating copy of item list
  tmp_table_field() splited
sql/item_cmpfunc.cc:
  changed references creation
sql/item_cmpfunc.h:
  changed references creation
sql/item_func.cc:
  some item made copyable
  methods for creating copy of item list
  changed references creation
sql/item_func.h:
  some item made copyable
  methods for creating copy of item list
  changed references creation
  tmp_table_field() splited
sql/item_subselect.cc:
  changed references creation
sql/item_sum.cc:
  some item made copyable
  methods for creating copy of item list
sql/item_sum.h:
  some item made copyable
  methods for creating copy of item list
sql/item_timefunc.h:
  tmp_table_field() splited
sql/item_uniq.h:
  some item made copyable
  methods for creating copy of item list
sql/mysql_priv.h:
  fixed subselects with temporary tables
sql/sql_base.cc:
  fixed subselects with temporary tables
sql/sql_class.h:
  fixed subselects with temporary tables
sql/sql_delete.cc:
  fixed subselects with temporary tables
sql/sql_derived.cc:
  fixed subselects with temporary tables
sql/sql_do.cc:
  fixed subselects with temporary tables
sql/sql_insert.cc:
  fixed subselects with temporary tables
sql/sql_lex.cc:
  fixed subselects with temporary tables
sql/sql_lex.h:
  fixed subselects with temporary tables
sql/sql_list.h:
  fixed subselects with temporary tables
sql/sql_load.cc:
  fixed subselects with temporary tables
sql/sql_olap.cc:
  fixed subselects with temporary tables
sql/sql_parse.cc:
  fixed subselects with temporary tables
sql/sql_prepare.cc:
  fixed subselects with temporary tables
sql/sql_select.cc:
  fixed subselects with temporary tables
sql/sql_select.h:
  fixed subselects with temporary tables
sql/sql_table.cc:
  fixed subselects with temporary tables
sql/sql_union.cc:
  fixed subselects with temporary tables
sql/sql_update.cc:
  fixed subselects with temporary tables
sql/sql_yacc.yy:
  fixed subselects with temporary tables
This commit is contained in:
unknown
2003-01-25 02:25:52 +02:00
parent 3b33f0c2c1
commit b23541339c
33 changed files with 1148 additions and 561 deletions

View File

@@ -50,7 +50,7 @@ int mysql_update(THD *thd,
List<Item> &fields,
List<Item> &values,
COND *conds,
ORDER *order,
uint order_num, ORDER *order,
ha_rows limit,
enum enum_duplicates handle_duplicates)
{
@@ -109,7 +109,7 @@ int mysql_update(THD *thd,
/* Check the fields we are going to modify */
table->grant.want_privilege=want_privilege;
if (setup_fields(thd,update_table_list,fields,1,0,0))
if (setup_fields(thd, 0, update_table_list, fields, 1, 0, 0))
DBUG_RETURN(-1); /* purecov: inspected */
if (table->timestamp_field)
{
@@ -122,8 +122,9 @@ int mysql_update(THD *thd,
/* Check values */
table->grant.want_privilege=(SELECT_ACL & ~table->grant.privilege);
if (setup_fields(thd,update_table_list,values,0,0,0))
if (setup_fields(thd, 0, update_table_list, values, 0, 0, 0))
{
free_ulderlayed_joins(thd, &thd->lex.select_lex);
DBUG_RETURN(-1); /* purecov: inspected */
}
@@ -134,6 +135,7 @@ int mysql_update(THD *thd,
(select && select->check_quick(safe_update, limit)) || !limit)
{
delete select;
free_ulderlayed_joins(thd, &thd->lex.select_lex);
if (error)
{
DBUG_RETURN(-1); // Error in where
@@ -148,6 +150,7 @@ int mysql_update(THD *thd,
if (safe_update && !using_limit)
{
delete select;
free_ulderlayed_joins(thd, &thd->lex.select_lex);
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
DBUG_RETURN(1);
}
@@ -175,6 +178,7 @@ int mysql_update(THD *thd,
DISK_BUFFER_SIZE, MYF(MY_WME)))
{
delete select; /* purecov: inspected */
free_ulderlayed_joins(thd, &thd->lex.select_lex);
DBUG_RETURN(-1);
}
if (old_used_keys & ((key_map) 1 << used_index))
@@ -197,7 +201,10 @@ int mysql_update(THD *thd,
table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));
if (setup_order(thd, &tables, fields, all_fields, order) ||
if (setup_ref_array(thd, &thd->lex.select_lex.ref_pointer_array,
order_num)||
setup_order(thd, thd->lex.select_lex.ref_pointer_array,
&tables, fields, all_fields, order) ||
!(sortorder=make_unireg_sortorder(order, &length)) ||
(table->found_records = filesort(thd, table, sortorder, length,
(SQL_SELECT *) 0,
@@ -205,6 +212,7 @@ int mysql_update(THD *thd,
== HA_POS_ERROR)
{
delete select;
free_ulderlayed_joins(thd, &thd->lex.select_lex);
DBUG_RETURN(-1);
}
}
@@ -258,6 +266,7 @@ int mysql_update(THD *thd,
if (error >= 0)
{
delete select;
free_ulderlayed_joins(thd, &thd->lex.select_lex);
DBUG_RETURN(-1);
}
}
@@ -343,6 +352,7 @@ int mysql_update(THD *thd,
}
delete select;
free_ulderlayed_joins(thd, &thd->lex.select_lex);
if (error >= 0)
send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0); /* purecov: inspected */
else
@@ -357,6 +367,7 @@ int mysql_update(THD *thd,
}
thd->count_cuted_fields=0; /* calc cuted fields */
free_io_cache(table);
DBUG_RETURN(0);
}
@@ -388,7 +399,7 @@ int mysql_multi_update(THD *thd,
DBUG_RETURN(res);
thd->select_limit=HA_POS_ERROR;
if (setup_fields(thd, table_list, *fields, 1, 0, 0))
if (setup_fields(thd, 0, table_list, *fields, 1, 0, 0))
DBUG_RETURN(-1);
/*
@@ -411,8 +422,9 @@ int mysql_multi_update(THD *thd,
DBUG_RETURN(-1);
List<Item> total_list;
res= mysql_select(thd,table_list,total_list,
conds, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
res= mysql_select(thd, &select_lex->ref_pointer_array,
table_list, select_lex->with_wild, total_list,
conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
(ORDER *)NULL,
options | SELECT_NO_JOIN_CACHE,
result, unit, select_lex, 0);
@@ -467,7 +479,7 @@ int multi_update::prepare(List<Item> &not_used_values, SELECT_LEX_UNIT *unit)
reference tables
*/
if (setup_fields(thd, all_tables, *values, 1,0,0))
if (setup_fields(thd, 0, all_tables, *values, 1, 0, 0))
DBUG_RETURN(1);
/*