diff options
author | unknown <konstantin@mysql.com> | 2005-09-02 17:21:19 +0400 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2005-09-02 17:21:19 +0400 |
commit | dc92221300d4d5b9e72d85373187d14d7f398c19 (patch) | |
tree | 6996d85b80a0fadca8491157c75d719dab155e97 /sql/sp_head.cc | |
parent | aeb7fe836a179457879e0204ac1e3addd3f6dd28 (diff) | |
download | mariadb-git-dc92221300d4d5b9e72d85373187d14d7f398c19.tar.gz |
Rename:
- current_arena to stmt_arena: the thread may have more than one
'current' arenas: one for runtime data, and one for the parsed
tree of a statement. Only one of them is active at any moment.
- set_item_arena -> set_query_arena, because Item_arena was renamed to
Query_arena a while ago
- set_n_backup_item_arena -> set_n_backup_active_arena;
the active arena is the arena thd->mem_root and thd->free_list
are currently pointing at.
- restore_backup_item_arena -> restore_active_arena (with the same
rationale)
- change_arena_if_needed -> activate_stmt_arena_if_needed; this
method sets thd->stmt_arena active if it's not done yet.
sql/item.cc:
Rename.
sql/item_cmpfunc.cc:
Rename.
sql/item_func.cc:
Rename.
sql/item_subselect.cc:
Rename.
sql/item_subselect.h:
Remove an unused forward declaration.
sql/item_sum.h:
Remove an unused forward declaration.
sql/mysql_priv.h:
Remove an unused forward declaration.
sql/sp.cc:
Rename.
sql/sp_head.cc:
Rename.
sql/sql_base.cc:
Rename.
sql/sql_class.cc:
Rename.
sql/sql_class.h:
Rename.
sql/sql_lex.cc:
Rename.
sql/sql_parse.cc:
Rename.
sql/sql_prepare.cc:
Rename.
sql/sql_select.cc:
Rename.
sql/sql_show.cc:
Rename.
sql/sql_union.cc:
Rename.
sql/sql_view.cc:
Rename.
sql/table.cc:
Rename.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r-- | sql/sp_head.cc | 72 |
1 files changed, 34 insertions, 38 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index e04523902db..59169f45f1b 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -131,12 +131,12 @@ sp_prepare_func_item(THD* thd, Item **it_addr) do \ { \ if (condition) \ - thd->set_n_backup_item_arena(thd->spcont->callers_arena, \ - backup_arena); \ + thd->set_n_backup_active_arena(thd->spcont->callers_arena, \ + backup_arena); \ new_command; \ if (condition) \ - thd->restore_backup_item_arena(thd->spcont->callers_arena, \ - &backup_current_arena); \ + thd->restore_active_arena(thd->spcont->callers_arena, \ + backup_arena); \ } while(0) /* @@ -167,7 +167,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type, DBUG_ENTER("sp_eval_func_item"); Item *it= sp_prepare_func_item(thd, it_addr); uint rsize; - Query_arena backup_current_arena; + Query_arena backup_arena; DBUG_PRINT("info", ("type: %d", type)); if (!it) @@ -187,7 +187,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type, } DBUG_PRINT("info", ("INT_RESULT: %d", i)); CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_int(i), - use_callers_arena, &backup_current_arena); + use_callers_arena, &backup_arena); break; } case REAL_RESULT: @@ -210,7 +210,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type, max_length= it->max_length; DBUG_PRINT("info", ("REAL_RESULT: %g", d)); CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_float(d), - use_callers_arena, &backup_current_arena); + use_callers_arena, &backup_arena); it->decimals= decimals; it->max_length= max_length; break; @@ -221,7 +221,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type, if (it->null_value) goto return_null_item; CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_decimal(val), - use_callers_arena, &backup_current_arena); + use_callers_arena, &backup_arena); #ifndef DBUG_OFF { char dbug_buff[DECIMAL_MAX_STR_LENGTH+1]; @@ -246,7 +246,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type, s->length(), s->c_ptr_quick())); CHARSET_INFO *itcs= it->collation.collation; CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_string(itcs), - use_callers_arena, &backup_current_arena); + use_callers_arena, &backup_arena); /* We have to use special constructor and allocate string on system heap here. This is because usual Item_string @@ -276,7 +276,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type, return_null_item: CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_null(), - use_callers_arena, &backup_current_arena); + use_callers_arena, &backup_arena); it->rsize= rsize; DBUG_RETURN(it); @@ -765,7 +765,7 @@ int sp_head::execute(THD *thd) /* per-instruction arena */ MEM_ROOT execute_mem_root; Query_arena execute_arena(&execute_mem_root, INITIALIZED_FOR_SP), - execute_backup_arena; + backup_arena; query_id_t old_query_id; TABLE *old_derived_tables; LEX *old_lex; @@ -812,7 +812,7 @@ int sp_head::execute(THD *thd) if ((ctx= thd->spcont)) ctx->clear_handler(); thd->query_error= 0; - old_arena= thd->current_arena; + old_arena= thd->stmt_arena; /* We have to save/restore this info when we are changing call level to @@ -848,13 +848,13 @@ int sp_head::execute(THD *thd) Switch to per-instruction arena here. We can do it since we cleanup arena after every instruction. */ - thd->set_n_backup_item_arena(&execute_arena, &execute_backup_arena); + thd->set_n_backup_active_arena(&execute_arena, &backup_arena); /* Save callers arena in order to store instruction results and out parameters in it later during sp_eval_func_item() */ - thd->spcont->callers_arena= &execute_backup_arena; + thd->spcont->callers_arena= &backup_arena; do { @@ -869,12 +869,12 @@ int sp_head::execute(THD *thd) if (!thd->in_sub_stmt) thd->set_time(); // Make current_time() et al work /* - We have to set thd->current_arena before executing the instruction + We have to set thd->stmt_arena before executing the instruction to store in the instruction free_list all new items, created during the first execution (for example expanding of '*' or the items made during other permanent subquery transformations). */ - thd->current_arena= i; + thd->stmt_arena= i; ret= i->execute(thd, &ip); /* @@ -907,9 +907,9 @@ int sp_head::execute(THD *thd) case SP_HANDLER_NONE: break; case SP_HANDLER_CONTINUE: - thd->restore_backup_item_arena(&execute_arena, &execute_backup_arena); + thd->restore_active_arena(&execute_arena, &backup_arena); ctx->save_variables(hf); - thd->set_n_backup_item_arena(&execute_arena, &execute_backup_arena); + thd->set_n_backup_active_arena(&execute_arena, &backup_arena); ctx->push_hstack(ip); // Fall through default: @@ -924,7 +924,7 @@ int sp_head::execute(THD *thd) } } while (ret == 0 && !thd->killed); - thd->restore_backup_item_arena(&execute_arena, &execute_backup_arena); + thd->restore_active_arena(&execute_arena, &backup_arena); /* Restore all saved */ @@ -939,7 +939,7 @@ int sp_head::execute(THD *thd) thd->derived_tables= old_derived_tables; thd->variables.sql_mode= save_sql_mode; - thd->current_arena= old_arena; + thd->stmt_arena= old_arena; state= EXECUTED; done: @@ -1532,7 +1532,7 @@ sp_head::restore_thd_mem_root(THD *thd) { DBUG_ENTER("sp_head::restore_thd_mem_root"); Item *flist= free_list; // The old list - set_item_arena(thd); // Get new free_list and mem_root + set_query_arena(thd); // Get new free_list and mem_root state= INITIALIZED_FOR_SP; DBUG_PRINT("info", ("mem_root 0x%lx returned from thd mem root 0x%lx", @@ -2359,20 +2359,18 @@ sp_instr_hreturn::opt_mark(sp_head *sp) int sp_instr_cpush::execute(THD *thd, uint *nextp) { - Query_arena backup_current_arena; + Query_arena backup_arena; DBUG_ENTER("sp_instr_cpush::execute"); /* We should create cursors in the callers arena, as it could be (and usually is) used in several instructions. */ - thd->set_n_backup_item_arena(thd->spcont->callers_arena, - &backup_current_arena); + thd->set_n_backup_active_arena(thd->spcont->callers_arena, &backup_arena); thd->spcont->push_cursor(&m_lex_keeper, this); - thd->restore_backup_item_arena(thd->spcont->callers_arena, - &backup_current_arena); + thd->restore_active_arena(thd->spcont->callers_arena, &backup_arena); *nextp= m_ip+1; @@ -2439,19 +2437,19 @@ sp_instr_copen::execute(THD *thd, uint *nextp) } else { - Query_arena *old_arena= thd->current_arena; + Query_arena *old_arena= thd->stmt_arena; /* Get the Query_arena from the cpush instruction, which contains the free_list of the query, so new items (if any) are stored in the right free_list, and we can cleanup after each open. */ - thd->current_arena= c->get_instr(); + thd->stmt_arena= c->get_instr(); res= lex_keeper->reset_lex_and_exec_core(thd, nextp, FALSE, this); /* Cleanup the query's items */ - if (thd->current_arena->free_list) - cleanup_items(thd->current_arena->free_list); - thd->current_arena= old_arena; + if (thd->stmt_arena->free_list) + cleanup_items(thd->stmt_arena->free_list); + thd->stmt_arena= old_arena; /* Work around the fact that errors in selects are not returned properly (but instead converted into a warning), so if a condition handler @@ -2526,18 +2524,16 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp) { sp_cursor *c= thd->spcont->get_cursor(m_cursor); int res; - Query_arena backup_current_arena; + Query_arena backup_arena; DBUG_ENTER("sp_instr_cfetch::execute"); if (! c) res= -1; else { - thd->set_n_backup_item_arena(thd->spcont->callers_arena, - &backup_current_arena); + thd->set_n_backup_active_arena(thd->spcont->callers_arena, &backup_arena); res= c->fetch(thd, &m_varlist); - thd->restore_backup_item_arena(thd->spcont->callers_arena, - &backup_current_arena); + thd->restore_active_arena(thd->spcont->callers_arena, &backup_arena); } *nextp= m_ip+1; @@ -2790,7 +2786,7 @@ sp_head::add_used_tables_to_table_list(THD *thd, /* Use persistent arena for table list allocation to be PS friendly. */ - arena= thd->change_arena_if_needed(&backup); + arena= thd->activate_stmt_arena_if_needed(&backup); for (i=0 ; i < m_sptabs.records ; i++) { @@ -2835,7 +2831,7 @@ sp_head::add_used_tables_to_table_list(THD *thd, } if (arena) - thd->restore_backup_item_arena(arena, &backup); + thd->restore_active_arena(arena, &backup); DBUG_RETURN(result); } |