summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc51
1 files changed, 33 insertions, 18 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index b637b04059c..a11796391d7 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -540,7 +540,7 @@ check_routine_name(LEX_STRING *ident)
my_error(ER_SP_WRONG_NAME, MYF(0), ident->str);
return TRUE;
}
- if (check_string_char_length(ident, "", NAME_CHAR_LEN,
+ if (check_string_char_length(ident, 0, NAME_CHAR_LEN,
system_charset_info, 1))
{
my_error(ER_TOO_LONG_IDENT, MYF(0), ident->str);
@@ -872,6 +872,7 @@ sp_head::create_result_field(uint field_max_length, const char *field_name,
field_max_length : m_return_field_def.length;
field= ::make_field(table->s, /* TABLE_SHARE ptr */
+ table->in_use->mem_root,
(uchar*) 0, /* field ptr */
field_length, /* field [max] length */
(uchar*) "", /* null ptr */
@@ -1129,7 +1130,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
const uint status_backup_mask= SERVER_STATUS_CURSOR_EXISTS |
SERVER_STATUS_LAST_ROW_SENT;
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
- Object_creation_ctx *saved_creation_ctx;
+ Object_creation_ctx *UNINIT_VAR(saved_creation_ctx);
Diagnostics_area *da= thd->get_stmt_da();
Warning_info sp_wi(da->warning_info_id(), false, true);
@@ -2019,7 +2020,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if (spvar->mode == sp_variable::MODE_OUT)
{
- Item_null *null_item= new Item_null();
+ Item_null *null_item= new (thd->mem_root) Item_null(thd);
Item *tmp_item= null_item;
if (!null_item ||
@@ -2559,6 +2560,7 @@ sp_head::show_create_routine(THD *thd, int type)
LEX_STRING sql_mode;
bool full_access;
+ MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("sp_head::show_create_routine");
DBUG_PRINT("info", ("routine %s", m_name.str));
@@ -2573,8 +2575,12 @@ sp_head::show_create_routine(THD *thd, int type)
/* Send header. */
- fields.push_back(new Item_empty_string(col1_caption, NAME_CHAR_LEN));
- fields.push_back(new Item_empty_string("sql_mode", sql_mode.length));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, col1_caption, NAME_CHAR_LEN),
+ thd->mem_root);
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "sql_mode", sql_mode.length),
+ thd->mem_root);
{
/*
@@ -2583,22 +2589,28 @@ sp_head::show_create_routine(THD *thd, int type)
*/
Item_empty_string *stmt_fld=
- new Item_empty_string(col3_caption,
+ new (mem_root) Item_empty_string(thd, col3_caption,
MY_MAX(m_defstr.length, 1024));
stmt_fld->maybe_null= TRUE;
- fields.push_back(stmt_fld);
+ fields.push_back(stmt_fld, thd->mem_root);
}
- fields.push_back(new Item_empty_string("character_set_client",
- MY_CS_NAME_SIZE));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "character_set_client",
+ MY_CS_NAME_SIZE),
+ thd->mem_root);
- fields.push_back(new Item_empty_string("collation_connection",
- MY_CS_NAME_SIZE));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "collation_connection",
+ MY_CS_NAME_SIZE),
+ thd->mem_root);
- fields.push_back(new Item_empty_string("Database Collation",
- MY_CS_NAME_SIZE));
+ fields.push_back(new (mem_root)
+ Item_empty_string(thd, "Database Collation",
+ MY_CS_NAME_SIZE),
+ thd->mem_root);
if (protocol->send_result_set_metadata(&fields,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -2781,10 +2793,13 @@ sp_head::show_routine_code(THD *thd)
if (check_show_routine_access(thd, this, &full_access) || !full_access)
DBUG_RETURN(1);
- field_list.push_back(new Item_uint("Pos", 9));
+ field_list.push_back(new (thd->mem_root) Item_uint(thd, "Pos", 9),
+ thd->mem_root);
// 1024 is for not to confuse old clients
- field_list.push_back(new Item_empty_string("Instruction",
- MY_MAX(buffer.length(), 1024)));
+ field_list.push_back(new (thd->mem_root)
+ Item_empty_string(thd, "Instruction",
+ MY_MAX(buffer.length(), 1024)),
+ thd->mem_root);
if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS |
Protocol::SEND_EOF))
DBUG_RETURN(1);
@@ -3851,7 +3866,7 @@ sp_instr_error::execute(THD *thd, uint *nextp)
{
DBUG_ENTER("sp_instr_error::execute");
- my_message(m_errcode, ER(m_errcode), MYF(0));
+ my_message(m_errcode, ER_THD(thd, m_errcode), MYF(0));
*nextp= m_ip+1;
DBUG_RETURN(-1);
}
@@ -3893,7 +3908,7 @@ sp_instr_set_case_expr::exec_core(THD *thd, uint *nextp)
initialized. Set to NULL so we can continue.
*/
- Item *null_item= new Item_null();
+ Item *null_item= new (thd->mem_root) Item_null(thd);
if (!null_item ||
thd->spcont->set_case_expr(thd, m_case_expr_id, &null_item))