Commit 5f24be65 authored by Mikael Ronstrom's avatar Mikael Ronstrom

Changed prefix from ES_ to STMT_ on Query arena state

parent fd926652
......@@ -550,7 +550,7 @@ sp_head::operator delete(void *ptr, size_t size) throw()
sp_head::sp_head()
:Query_arena(&main_mem_root, ES_INITIALIZED_FOR_SP),
:Query_arena(&main_mem_root, STMT_INITIALIZED_FOR_SP),
m_flags(0),
m_sp_cache_version(0),
unsafe_flags(0),
......@@ -1208,7 +1208,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
Query_arena *old_arena;
/* per-instruction arena */
MEM_ROOT execute_mem_root;
Query_arena execute_arena(&execute_mem_root, ES_INITIALIZED_FOR_SP),
Query_arena execute_arena(&execute_mem_root, STMT_INITIALIZED_FOR_SP),
backup_arena;
query_id_t old_query_id;
TABLE *old_derived_tables;
......@@ -1488,7 +1488,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
thd->m_reprepare_observer= save_reprepare_observer;
thd->stmt_arena= old_arena;
state= ES_EXECUTED;
state= STMT_EXECUTED;
/*
Restore the caller's original warning information area:
......@@ -1646,7 +1646,7 @@ sp_head::execute_trigger(THD *thd,
sp_rcontext *nctx = NULL;
bool err_status= FALSE;
MEM_ROOT call_mem_root;
Query_arena call_arena(&call_mem_root, Query_arena::ES_INITIALIZED_FOR_SP);
Query_arena call_arena(&call_mem_root, Query_arena::STMT_INITIALIZED_FOR_SP);
Query_arena backup_arena;
DBUG_ENTER("sp_head::execute_trigger");
......@@ -1787,7 +1787,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
String binlog_buf(buf, sizeof(buf), &my_charset_bin);
bool err_status= FALSE;
MEM_ROOT call_mem_root;
Query_arena call_arena(&call_mem_root, Query_arena::ES_INITIALIZED_FOR_SP);
Query_arena call_arena(&call_mem_root, Query_arena::STMT_INITIALIZED_FOR_SP);
Query_arena backup_arena;
DBUG_ENTER("sp_head::execute_function");
DBUG_PRINT("info", ("function %s", m_name.str));
......@@ -2544,7 +2544,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_query_arena(thd); // Get new free_list and mem_root
state= ES_INITIALIZED_FOR_SP;
state= STMT_INITIALIZED_FOR_SP;
DBUG_PRINT("info", ("mem_root 0x%lx returned from thd mem root 0x%lx",
(ulong) &mem_root, (ulong) &thd->mem_root));
......@@ -3008,7 +3008,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
(thd->stmt_da->sql_errno() != ER_CANT_REOPEN_TABLE &&
thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE &&
thd->stmt_da->sql_errno() != ER_UPDATE_TABLE_USED))
thd->stmt_arena->state= Query_arena::ES_EXECUTED;
thd->stmt_arena->state= Query_arena::STMT_EXECUTED;
/*
Merge here with the saved parent's values
......
......@@ -560,7 +560,7 @@ class sp_instr :public Query_arena, public Sql_alloc
/// Should give each a name or type code for debugging purposes?
sp_instr(uint ip, sp_pcontext *ctx)
:Query_arena(0, ES_INITIALIZED_FOR_SP), marked(0), m_ip(ip), m_ctx(ctx)
:Query_arena(0, STMT_INITIALIZED_FOR_SP), marked(0), m_ip(ip), m_ctx(ctx)
{}
virtual ~sp_instr()
......
......@@ -624,14 +624,14 @@ class Query_arena
/*
The states relfects three diffrent life cycles for three
different types of statements:
Prepared statement: ES_INITIALIZED -> ES_PREPARED -> ES_EXECUTED.
Stored procedure: ES_INITIALIZED_FOR_SP -> ES_EXECUTED.
Other statements: ES_CONVENTIONAL_EXECUTION never changes.
Prepared statement: STMT_INITIALIZED -> STMT_PREPARED -> STMT_EXECUTED.
Stored procedure: STMT_INITIALIZED_FOR_SP -> STMT_EXECUTED.
Other statements: STMT_CONVENTIONAL_EXECUTION never changes.
*/
enum enum_state
{
ES_INITIALIZED= 0, ES_INITIALIZED_FOR_SP= 1, ES_PREPARED= 2,
ES_CONVENTIONAL_EXECUTION= 3, ES_EXECUTED= 4, ES_ERROR= -1
STMT_INITIALIZED= 0, STMT_INITIALIZED_FOR_SP= 1, STMT_PREPARED= 2,
STMT_CONVENTIONAL_EXECUTION= 3, STMT_EXECUTED= 4, STMT_ERROR= -1
};
enum_state state;
......@@ -654,18 +654,18 @@ class Query_arena
virtual Type type() const;
virtual ~Query_arena() {};
inline bool is_stmt_prepare() const { return state == ES_INITIALIZED; }
inline bool is_stmt_prepare() const { return state == STMT_INITIALIZED; }
inline bool is_first_sp_execute() const
{ return state == ES_INITIALIZED_FOR_SP; }
{ return state == STMT_INITIALIZED_FOR_SP; }
inline bool is_stmt_prepare_or_first_sp_execute() const
{ return (int)state < (int)ES_PREPARED; }
{ return (int)state < (int)STMT_PREPARED; }
inline bool is_stmt_prepare_or_first_stmt_execute() const
{ return (int)state <= (int)ES_PREPARED; }
inline bool is_first_stmt_execute() const { return state == ES_PREPARED; }
{ return (int)state <= (int)STMT_PREPARED; }
inline bool is_first_stmt_execute() const { return state == STMT_PREPARED; }
inline bool is_stmt_execute() const
{ return state == ES_PREPARED || state == ES_EXECUTED; }
{ return state == STMT_PREPARED || state == STMT_EXECUTED; }
inline bool is_conventional() const
{ return state == ES_CONVENTIONAL_EXECUTION; }
{ return state == STMT_CONVENTIONAL_EXECUTION; }
inline void* alloc(size_t size) { return alloc_root(mem_root,size); }
inline void* calloc(size_t size)
......
......@@ -46,7 +46,7 @@ class Server_side_cursor: protected Query_arena, public Sql_alloc
select_result *result;
public:
Server_side_cursor(MEM_ROOT *mem_root_arg, select_result *result_arg)
:Query_arena(mem_root_arg, ES_INITIALIZED), result(result_arg)
:Query_arena(mem_root_arg, STMT_INITIALIZED), result(result_arg)
{}
virtual bool is_open() const= 0;
......
......@@ -2712,7 +2712,7 @@ void mysqld_stmt_reset(THD *thd, char *packet)
*/
reset_stmt_params(stmt);
stmt->state= Query_arena::ES_PREPARED;
stmt->state= Query_arena::STMT_PREPARED;
general_log_print(thd, thd->command, NullS);
......@@ -2830,7 +2830,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
if (param_number >= stmt->param_count)
{
/* Error will be sent in execute call */
stmt->state= Query_arena::ES_ERROR;
stmt->state= Query_arena::STMT_ERROR;
stmt->last_errno= ER_WRONG_ARGUMENTS;
sprintf(stmt->last_error, ER(ER_WRONG_ARGUMENTS),
"mysqld_stmt_send_long_data");
......@@ -2846,7 +2846,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
if (param->set_longdata(thd->extra_data, thd->extra_length))
#endif
{
stmt->state= Query_arena::ES_ERROR;
stmt->state= Query_arena::STMT_ERROR;
stmt->last_errno= ER_OUTOFMEMORY;
sprintf(stmt->last_error, ER(ER_OUTOFMEMORY), 0);
}
......@@ -2999,7 +2999,7 @@ Execute_sql_statement::execute_server_code(THD *thd)
Prepared_statement::Prepared_statement(THD *thd_arg)
:Statement(NULL, &main_mem_root,
ES_INITIALIZED, ++thd_arg->statement_id_counter),
STMT_INITIALIZED, ++thd_arg->statement_id_counter),
thd(thd_arg),
result(thd_arg),
param_array(0),
......@@ -3272,7 +3272,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
{
setup_set_params();
lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_PREPARE;
state= Query_arena::ES_PREPARED;
state= Query_arena::STMT_PREPARED;
flags&= ~ (uint) IS_IN_USE;
/*
......@@ -3446,7 +3446,7 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable)
Item_change_list save_change_list;
thd->change_list.move_elements_to(&save_change_list);
state= ES_CONVENTIONAL_EXECUTION;
state= STMT_CONVENTIONAL_EXECUTION;
if (!(lex= new (mem_root) st_lex_local))
return TRUE;
......@@ -3657,7 +3657,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
status_var_increment(thd->status_var.com_stmt_execute);
/* Check if we got an error when sending long data */
if (state == Query_arena::ES_ERROR)
if (state == Query_arena::STMT_ERROR)
{
my_message(last_errno, last_error, MYF(0));
return TRUE;
......@@ -3787,8 +3787,8 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
thd->set_statement(&stmt_backup);
thd->stmt_arena= old_stmt_arena;
if (state == Query_arena::ES_PREPARED)
state= Query_arena::ES_EXECUTED;
if (state == Query_arena::STMT_PREPARED)
state= Query_arena::STMT_EXECUTED;
if (error == 0 && this->lex->sql_command == SQLCOM_CALL)
{
......
......@@ -1933,7 +1933,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
Query_arena *backup_stmt_arena_ptr= thd->stmt_arena;
Query_arena backup_arena;
Query_arena part_func_arena(&outparam->mem_root, Query_arena::ES_INITIALIZED);
Query_arena part_func_arena(&outparam->mem_root,
Query_arena::STMT_INITIALIZED);
thd->set_n_backup_active_arena(&part_func_arena, &backup_arena);
thd->stmt_arena= &part_func_arena;
bool tmp;
......
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