summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/event_data_objects.cc8
-rw-r--r--sql/field.h2
-rw-r--r--sql/item_func.cc12
-rw-r--r--sql/sp.cc72
-rw-r--r--sql/sp.h2
-rw-r--r--sql/sp_head.cc30
-rw-r--r--sql/sp_head.h19
-rw-r--r--sql/sql_lex.cc5
-rw-r--r--sql/sql_lex.h8
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_trigger.cc10
-rw-r--r--sql/sql_yacc.yy7
-rw-r--r--sql/sql_yacc_ora.yy7
-rw-r--r--sql/wsrep_mysqld.cc2
14 files changed, 110 insertions, 76 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index 86bdadabc17..2ab06fb34f2 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -1426,7 +1426,13 @@ Event_job_data::execute(THD *thd, bool drop)
sphead->m_flags|= sp_head::LOG_SLOW_STATEMENTS;
sphead->m_flags|= sp_head::LOG_GENERAL_LOG;
- sphead->set_info(0, 0, &thd->lex->sp_chistics, sql_mode);
+ /*
+ construct_sp_sql() + parse_sql() set suid to SP_IS_NOT_SUID,
+ because we have the security context already set to the event
+ definer here. See more comments in construct_sp_sql().
+ */
+ DBUG_ASSERT(sphead->suid() == SP_IS_NOT_SUID);
+ sphead->m_sql_mode= sql_mode;
sphead->set_creation_ctx(creation_ctx);
sphead->optimize();
diff --git a/sql/field.h b/sql/field.h
index 92fc9b4cca8..208941b3daa 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -818,6 +818,8 @@ public:
{ return store(ls->str, ls->length, cs); }
int store(const LEX_CSTRING *ls, CHARSET_INFO *cs)
{ return store(ls->str, ls->length, cs); }
+ int store(const LEX_CSTRING &ls, CHARSET_INFO *cs)
+ { return store(ls.str, ls.length, cs); }
virtual double val_real(void)=0;
virtual longlong val_int(void)=0;
virtual bool val_bool(void)= 0;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index f56ede71b40..b44b29c15a5 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -6316,7 +6316,7 @@ Item_func_sp::init_result_field(THD *thd)
bool Item_func_sp::is_expensive()
{
- return !m_sp->m_chistics->detistic ||
+ return !m_sp->detistic() ||
current_thd->locked_tables_mode < LTM_LOCK_TABLES;
}
@@ -6390,8 +6390,8 @@ Item_func_sp::execute_impl(THD *thd)
Sub_statement_state statement_state;
Security_context *save_security_ctx= thd->security_ctx;
enum enum_sp_data_access access=
- (m_sp->m_chistics->daccess == SP_DEFAULT_ACCESS) ?
- SP_DEFAULT_ACCESS_MAPPING : m_sp->m_chistics->daccess;
+ (m_sp->daccess() == SP_DEFAULT_ACCESS) ?
+ SP_DEFAULT_ACCESS_MAPPING : m_sp->daccess();
DBUG_ENTER("Item_func_sp::execute_impl");
@@ -6408,7 +6408,7 @@ Item_func_sp::execute_impl(THD *thd)
statement-based replication (SBR) is active.
*/
- if (!m_sp->m_chistics->detistic && !trust_function_creators &&
+ if (!m_sp->detistic() && !trust_function_creators &&
(access == SP_CONTAINS_SQL || access == SP_MODIFIES_SQL_DATA) &&
(mysql_bin_log.is_open() &&
thd->variables.binlog_format == BINLOG_FORMAT_STMT))
@@ -6590,7 +6590,7 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
#endif /* ! NO_EMBEDDED_ACCESS_CHECKS */
}
- if (!m_sp->m_chistics->detistic)
+ if (!m_sp->detistic())
{
used_tables_cache |= RAND_TABLE_BIT;
const_item_cache= FALSE;
@@ -6604,7 +6604,7 @@ void Item_func_sp::update_used_tables()
{
Item_func::update_used_tables();
- if (!m_sp->m_chistics->detistic)
+ if (!m_sp->detistic())
{
used_tables_cache |= RAND_TABLE_BIT;
const_item_cache= FALSE;
diff --git a/sql/sp.cc b/sql/sp.cc
index 35b52c526a4..a01861b3d61 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -487,9 +487,8 @@ db_find_routine_aux(THD *thd, stored_procedure_type type, const sp_name *name,
*/
if (name->m_name.length > table->field[1]->field_length)
DBUG_RETURN(SP_KEY_NOT_FOUND);
- table->field[0]->store(name->m_db.str, name->m_db.length, &my_charset_bin);
- table->field[1]->store(name->m_name.str, name->m_name.length,
- &my_charset_bin);
+ table->field[0]->store(name->m_db, &my_charset_bin);
+ table->field[1]->store(name->m_name, &my_charset_bin);
table->field[2]->store((longlong) type, TRUE);
key_copy(key, table->record[0], table->key_info,
table->key_info->key_length);
@@ -533,7 +532,7 @@ db_find_routine(THD *thd, stored_procedure_type type, const sp_name *name,
const char *definer;
longlong created;
longlong modified;
- st_sp_chistics chistics;
+ Sp_chistics chistics;
char *ptr;
uint length;
char buff[65];
@@ -567,7 +566,6 @@ db_find_routine(THD *thd, stored_procedure_type type, const sp_name *name,
goto done;
}
- bzero((char *)&chistics, sizeof(chistics));
if ((ptr= get_field(thd->mem_root,
table->field[MYSQL_PROC_FIELD_ACCESS])) == NULL)
{
@@ -849,7 +847,7 @@ db_load_routine(THD *thd, stored_procedure_type type,
params, strlen(params),
returns, strlen(returns),
body, strlen(body),
- &chistics, definer_user_name, definer_host_name,
+ chistics, definer_user_name, definer_host_name,
sql_mode))
{
ret= SP_INTERNAL_ERROR;
@@ -902,7 +900,7 @@ db_load_routine(THD *thd, stored_procedure_type type,
}
(*sphp)->set_definer(definer_user_name, definer_host_name);
- (*sphp)->set_info(created, modified, &chistics, sql_mode);
+ (*sphp)->set_info(created, modified, chistics, sql_mode);
(*sphp)->set_creation_ctx(creation_ctx);
(*sphp)->optimize();
/*
@@ -1139,11 +1137,11 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
store_failed=
table->field[MYSQL_PROC_FIELD_DB]->
- store(sp->m_db.str, sp->m_db.length, system_charset_info);
+ store(sp->m_db, system_charset_info);
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_NAME]->
- store(sp->m_name.str, sp->m_name.length, system_charset_info);
+ store(sp->m_name, system_charset_info);
store_failed= store_failed ||
table->field[MYSQL_PROC_MYSQL_TYPE]->
@@ -1151,29 +1149,29 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_SPECIFIC_NAME]->
- store(sp->m_name.str, sp->m_name.length, system_charset_info);
+ store(sp->m_name, system_charset_info);
- if (sp->m_chistics->daccess != SP_DEFAULT_ACCESS)
+ if (sp->daccess() != SP_DEFAULT_ACCESS)
{
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_ACCESS]->
- store((longlong)sp->m_chistics->daccess, TRUE);
+ store((longlong)sp->daccess(), TRUE);
}
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_DETERMINISTIC]->
- store((longlong)(sp->m_chistics->detistic ? 1 : 2), TRUE);
+ store((longlong)(sp->detistic() ? 1 : 2), TRUE);
- if (sp->m_chistics->suid != SP_IS_DEFAULT_SUID)
+ if (sp->suid() != SP_IS_DEFAULT_SUID)
{
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]->
- store((longlong)sp->m_chistics->suid, TRUE);
+ store((longlong)sp->suid(), TRUE);
}
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_PARAM_LIST]->
- store(sp->m_params.str, sp->m_params.length, system_charset_info);
+ store(sp->m_params, system_charset_info);
if (sp->m_type == TYPE_ENUM_FUNCTION)
{
@@ -1186,11 +1184,11 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_BODY]->
- store(sp->m_body.str, sp->m_body.length, system_charset_info);
+ store(sp->m_body, system_charset_info);
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_DEFINER]->
- store(definer.str, definer.length, system_charset_info);
+ store(definer, system_charset_info);
((Field_timestamp *)table->field[MYSQL_PROC_FIELD_CREATED])->set_time();
((Field_timestamp *)table->field[MYSQL_PROC_FIELD_MODIFIED])->set_time();
@@ -1199,26 +1197,25 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
table->field[MYSQL_PROC_FIELD_SQL_MODE]->
store((longlong)saved_mode, TRUE);
- if (sp->m_chistics->comment.str)
+ if (sp->comment().str)
{
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_COMMENT]->
- store(sp->m_chistics->comment.str, sp->m_chistics->comment.length,
- system_charset_info);
+ store(sp->comment(), system_charset_info);
}
if ((sp->m_type == TYPE_ENUM_FUNCTION) &&
!trust_function_creators && mysql_bin_log.is_open())
{
- if (!sp->m_chistics->detistic)
+ if (!sp->detistic())
{
/*
Note that this test is not perfect; one could use
a non-deterministic read-only function in an update statement.
*/
enum enum_sp_data_access access=
- (sp->m_chistics->daccess == SP_DEFAULT_ACCESS) ?
- SP_DEFAULT_ACCESS_MAPPING : sp->m_chistics->daccess;
+ (sp->daccess() == SP_DEFAULT_ACCESS) ?
+ SP_DEFAULT_ACCESS_MAPPING : sp->daccess();
if (access == SP_CONTAINS_SQL ||
access == SP_MODIFIES_SQL_DATA)
{
@@ -1255,7 +1252,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
table->field[MYSQL_PROC_FIELD_BODY_UTF8]->set_notnull();
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_BODY_UTF8]->store(
- sp->m_body_utf8.str, sp->m_body_utf8.length, system_charset_info);
+ sp->m_body_utf8, system_charset_info);
if (store_failed)
{
@@ -1291,7 +1288,7 @@ log:
sp->m_params.str, sp->m_params.length,
retstr.ptr(), retstr.length(),
sp->m_body.str, sp->m_body.length,
- sp->m_chistics, &(thd->lex->definer->user),
+ sp->chistics(), &(thd->lex->definer->user),
&(thd->lex->definer->host),
saved_mode))
{
@@ -1448,8 +1445,7 @@ sp_update_routine(THD *thd, stored_procedure_type type, const sp_name *name,
table->field[MYSQL_PROC_FIELD_ACCESS]->
store((longlong)chistics->daccess, TRUE);
if (chistics->comment.str)
- table->field[MYSQL_PROC_FIELD_COMMENT]->store(chistics->comment.str,
- chistics->comment.length,
+ table->field[MYSQL_PROC_FIELD_COMMENT]->store(chistics->comment,
system_charset_info);
if ((ret= table->file->ha_update_row(table->record[1],table->record[0])) &&
ret != HA_ERR_RECORD_IS_THE_SAME)
@@ -1792,7 +1788,7 @@ sp_find_routine(THD *thd, stored_procedure_type type, const sp_name *name,
}
if (db_load_routine(thd, type, name, &new_sp,
sp->m_sql_mode, sp->m_params.str, returns,
- sp->m_body.str, *sp->m_chistics,
+ sp->m_body.str, sp->chistics(),
&sp->m_definer.user, &sp->m_definer.host,
sp->m_created, sp->m_modified,
sp->get_creation_ctx()) == SP_OK)
@@ -2201,7 +2197,7 @@ show_create_sp(THD *thd, String *buf,
const char *params, ulong paramslen,
const char *returns, ulong returnslen,
const char *body, ulong bodylen,
- const st_sp_chistics *chistics,
+ const st_sp_chistics &chistics,
const LEX_CSTRING *definer_user,
const LEX_CSTRING *definer_host,
sql_mode_t sql_mode)
@@ -2209,7 +2205,7 @@ show_create_sp(THD *thd, String *buf,
sql_mode_t old_sql_mode= thd->variables.sql_mode;
/* Make some room to begin with */
if (buf->alloc(100 + dblen + 1 + namelen + paramslen + returnslen + bodylen +
- chistics->comment.length + 10 /* length of " DEFINER= "*/ +
+ chistics.comment.length + 10 /* length of " DEFINER= "*/ +
USER_HOST_BUFF_SIZE))
return FALSE;
@@ -2243,7 +2239,7 @@ show_create_sp(THD *thd, String *buf,
buf->append(returns, returnslen);
}
buf->append('\n');
- switch (chistics->daccess) {
+ switch (chistics.daccess) {
case SP_NO_SQL:
buf->append(STRING_WITH_LEN(" NO SQL\n"));
break;
@@ -2258,14 +2254,14 @@ show_create_sp(THD *thd, String *buf,
/* Do nothing */
break;
}
- if (chistics->detistic)
+ if (chistics.detistic)
buf->append(STRING_WITH_LEN(" DETERMINISTIC\n"));
- if (chistics->suid == SP_IS_NOT_SUID)
+ if (chistics.suid == SP_IS_NOT_SUID)
buf->append(STRING_WITH_LEN(" SQL SECURITY INVOKER\n"));
- if (chistics->comment.length)
+ if (chistics.comment.length)
{
buf->append(STRING_WITH_LEN(" COMMENT "));
- append_unescaped(buf, chistics->comment.str, chistics->comment.length);
+ append_unescaped(buf, chistics.comment.str, chistics.comment.length);
buf->append('\n');
}
buf->append(body, bodylen);
@@ -2303,7 +2299,6 @@ sp_load_for_information_schema(THD *thd, TABLE *proc_table, String *db,
{
const char *sp_body;
String defstr;
- struct st_sp_chistics sp_chistics;
const LEX_CSTRING definer_user= {STRING_WITH_LEN("")};
const LEX_CSTRING definer_host= {STRING_WITH_LEN("")};
LEX_CSTRING sp_db_str;
@@ -2326,7 +2321,6 @@ sp_load_for_information_schema(THD *thd, TABLE *proc_table, String *db,
Stored_program_creation_ctx *creation_ctx=
Stored_routine_creation_ctx::load_from_db(thd, &sp_name_obj, proc_table);
sp_body= (type == TYPE_ENUM_FUNCTION ? "RETURN NULL" : "BEGIN END");
- bzero((char*) &sp_chistics, sizeof(sp_chistics));
defstr.set_charset(creation_ctx->get_client_cs());
if (!show_create_sp(thd, &defstr, type,
sp_db_str.str, sp_db_str.length,
@@ -2334,7 +2328,7 @@ sp_load_for_information_schema(THD *thd, TABLE *proc_table, String *db,
params, strlen(params),
returns, strlen(returns),
sp_body, strlen(sp_body),
- &sp_chistics, &definer_user, &definer_host, sql_mode))
+ Sp_chistics(), &definer_user, &definer_host, sql_mode))
return 0;
thd->lex= &newlex;
diff --git a/sql/sp.h b/sql/sp.h
index d33c767369e..dc93b8b20ee 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -240,7 +240,7 @@ bool show_create_sp(THD *thd, String *buf,
const char *params, ulong paramslen,
const char *returns, ulong returnslen,
const char *body, ulong bodylen,
- const st_sp_chistics *chistics,
+ const st_sp_chistics &chistics,
const LEX_CSTRING *definer_user,
const LEX_CSTRING *definer_host,
sql_mode_t sql_mode);
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 973eeef0165..bb3275316cc 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -559,6 +559,8 @@ sp_head::sp_head(stored_procedure_type type)
m_sp_cache_version(0),
m_creation_ctx(0),
unsafe_flags(0),
+ m_created(0),
+ m_modified(0),
m_recursion_level(0),
m_next_cached_sp(0),
m_param_begin(NULL),
@@ -1408,7 +1410,7 @@ set_routine_security_ctx(THD *thd, sp_head *sp, bool is_proc,
Security_context **save_ctx)
{
*save_ctx= 0;
- if (sp->m_chistics->suid != SP_IS_NOT_SUID &&
+ if (sp->suid() != SP_IS_NOT_SUID &&
sp->m_security_ctx.change_security_context(thd, &sp->m_definer.user,
&sp->m_definer.host,
&sp->m_db,
@@ -1520,7 +1522,7 @@ sp_head::execute_trigger(THD *thd,
Security_context *save_ctx= NULL;
- if (m_chistics->suid != SP_IS_NOT_SUID &&
+ if (suid() != SP_IS_NOT_SUID &&
m_security_ctx.change_security_context(thd,
&m_definer.user,
&m_definer.host,
@@ -2433,19 +2435,25 @@ sp_head::sp_add_instr_cpush_for_cursors(THD *thd, sp_pcontext *pcontext)
void
+sp_head::set_chistics(const st_sp_chistics &chistics)
+{
+ m_chistics.set(chistics);
+ if (m_chistics.comment.length == 0)
+ m_chistics.comment.str= 0;
+ else
+ m_chistics.comment.str= strmake_root(mem_root,
+ m_chistics.comment.str,
+ m_chistics.comment.length);
+}
+
+
+void
sp_head::set_info(longlong created, longlong modified,
- const st_sp_chistics *chistics, sql_mode_t sql_mode)
+ const st_sp_chistics &chistics, sql_mode_t sql_mode)
{
m_created= created;
m_modified= modified;
- m_chistics= (st_sp_chistics *) memdup_root(mem_root, (char*) chistics,
- sizeof(*chistics));
- if (m_chistics->comment.length == 0)
- m_chistics->comment.str= 0;
- else
- m_chistics->comment.str= strmake_root(mem_root,
- m_chistics->comment.str,
- m_chistics->comment.length);
+ set_chistics(chistics);
m_sql_mode= sql_mode;
}
diff --git a/sql/sp_head.h b/sql/sp_head.h
index cf05d47a95c..1435bb460c3 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -179,7 +179,15 @@ public:
Column_definition m_return_field_def; /**< This is used for FUNCTIONs only. */
const char *m_tmp_query; ///< Temporary pointer to sub query string
- st_sp_chistics *m_chistics;
+private:
+ /*
+ Private to guarantee that m_chistics.comment is properly set to:
+ - a string which is alloced on this->mem_root
+ - or (NULL,0)
+ set_chistics() makes sure this.
+ */
+ Sp_chistics m_chistics;
+public:
sql_mode_t m_sql_mode; ///< For SHOW CREATE and execution
bool m_explicit_name; /**< Prepend the db name? */
LEX_CSTRING m_qname; ///< db.name
@@ -189,6 +197,12 @@ public:
LEX_CSTRING m_defstr;
AUTHID m_definer;
+ const st_sp_chistics &chistics() const { return m_chistics; }
+ const LEX_CSTRING &comment() const { return m_chistics.comment; }
+ void set_suid(enum_sp_suid_behaviour suid) { m_chistics.suid= suid; }
+ enum_sp_suid_behaviour suid() const { return m_chistics.suid; }
+ bool detistic() const { return m_chistics.detistic; }
+ enum_sp_data_access daccess() const { return m_chistics.daccess; }
/**
Is this routine being executed?
*/
@@ -671,8 +685,9 @@ public:
m_flags|= sp_head::HAS_COLUMN_TYPE_REFS;
}
+ void set_chistics(const st_sp_chistics &chistics);
void set_info(longlong created, longlong modified,
- const st_sp_chistics *chistics, sql_mode_t sql_mode);
+ const st_sp_chistics &chistics, sql_mode_t sql_mode);
void set_definer(const char *definer, uint definerlen);
void set_definer(const LEX_CSTRING *user_name, const LEX_CSTRING *host_name)
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 20e5fc0b450..112ce36b1bf 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -5831,10 +5831,9 @@ sp_head *LEX::make_sp_head(THD *thd, sp_name *name,
sp->init(this);
if (name)
sp->init_sp_name(thd, name);
- sp->m_chistics= &sp_chistics;
sphead= sp;
}
- bzero(&sp_chistics, sizeof(sp_chistics));
+ sp_chistics.init();
return sp;
}
@@ -6124,7 +6123,7 @@ bool LEX::maybe_start_compound_statement(THD *thd)
{
if (!make_sp_head(thd, NULL, TYPE_ENUM_PROCEDURE))
return true;
- sp_chistics.suid= SP_IS_NOT_SUID;
+ sphead->set_suid(SP_IS_NOT_SUID);
sphead->set_body_start(thd, thd->m_parser_state->m_lip.get_cpp_ptr());
}
return false;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 695a397c25f..3c7c99dff3d 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1285,9 +1285,17 @@ struct st_sp_chistics
enum enum_sp_suid_behaviour suid;
bool detistic;
enum enum_sp_data_access daccess;
+ void init() { bzero(this, sizeof(*this)); }
+ void set(const st_sp_chistics &other) { *this= other; }
};
+class Sp_chistics: public st_sp_chistics
+{
+public:
+ Sp_chistics() { init(); }
+};
+
struct st_trg_chistics: public st_trg_execution_order
{
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 50e8d57e75d..95af02f6ab3 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2710,7 +2710,7 @@ bool sp_process_definer(THD *thd)
DBUG_RETURN(TRUE);
if (thd->slave_thread && lex->sphead)
- lex->sphead->m_chistics->suid= SP_IS_NOT_SUID;
+ lex->sphead->set_suid(SP_IS_NOT_SUID);
}
else
{
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index e0980711afe..291d55d61a2 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -663,7 +663,7 @@ static void build_trig_stmt_query(THD *thd, TABLE_LIST *tables,
if (lex->create_info.or_replace())
stmt_query->append(STRING_WITH_LEN("OR REPLACE "));
- if (lex->sphead->m_chistics->suid != SP_IS_NOT_SUID)
+ if (lex->sphead->suid() != SP_IS_NOT_SUID)
{
/* SUID trigger */
lex->definer->set_lex_string(trg_definer, trg_definer_holder);
@@ -1431,7 +1431,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
lex.set_trg_event_type_for_tables();
if (lex.sphead)
- lex.sphead->set_info(0, 0, &lex.sp_chistics, sql_mode);
+ lex.sphead->m_sql_mode= sql_mode;
if (unlikely(!(trigger= (new (&table->mem_root)
Trigger(trigger_list, lex.sphead)))))
@@ -1489,7 +1489,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
continue;
}
- sp->set_info(0, 0, &lex.sp_chistics, sql_mode);
+ sp->m_sql_mode= sql_mode;
sp->set_creation_ctx(creation_ctx);
if (!trg_definer || !trg_definer->length)
@@ -1519,7 +1519,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
authorization of the invoker.
*/
- sp->m_chistics->suid= SP_IS_NOT_SUID;
+ sp->set_suid(SP_IS_NOT_SUID);
}
else
{
@@ -1691,7 +1691,7 @@ void Trigger::get_trigger_info(LEX_CSTRING *trigger_stmt,
}
*trigger_body= body->m_body_utf8;
- if (body->m_chistics->suid == SP_IS_NOT_SUID)
+ if (body->suid() == SP_IS_NOT_SUID)
{
*definer= empty_lex_str;
}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 70a9299ec3d..17f8b3849d3 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -2950,7 +2950,6 @@ ev_sql_stmt:
TYPE_ENUM_PROCEDURE))
MYSQL_YYABORT;
- lex->sp_chistics.suid= SP_IS_SUID; //always the definer!
lex->sphead->set_body_start(thd, lip->get_cpp_ptr());
}
sp_proc_stmt
@@ -7230,7 +7229,7 @@ alter:
if (lex->sphead)
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE"));
- bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
+ lex->sp_chistics.init();
}
sp_a_chistics
{
@@ -7245,7 +7244,7 @@ alter:
if (lex->sphead)
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
- bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
+ lex->sp_chistics.init();
}
sp_a_chistics
{
@@ -16674,6 +16673,7 @@ sf_tail:
LEX *lex= thd->lex;
Lex_input_stream *lip= YYLIP;
+ lex->sphead->set_chistics(lex->sp_chistics);
lex->sphead->set_body_start(thd, lip->get_cpp_tok_start());
}
sp_proc_stmt_in_returns_clause
@@ -16705,6 +16705,7 @@ sp_tail:
sp_parenthesized_pdparam_list
sp_c_chistics
{
+ Lex->sphead->set_chistics(Lex->sp_chistics);
Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start());
}
sp_proc_stmt
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index d720cd18faf..e177ed1cb48 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -2391,7 +2391,6 @@ ev_sql_stmt:
TYPE_ENUM_PROCEDURE))
MYSQL_YYABORT;
- lex->sp_chistics.suid= SP_IS_SUID; //always the definer!
lex->sphead->set_body_start(thd, lip->get_cpp_ptr());
}
sp_proc_stmt
@@ -7211,7 +7210,7 @@ alter:
if (lex->sphead)
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE"));
- bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
+ lex->sp_chistics.init();
}
sp_a_chistics
{
@@ -7226,7 +7225,7 @@ alter:
if (lex->sphead)
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
- bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
+ lex->sp_chistics.init();
}
sp_a_chistics
{
@@ -16913,6 +16912,7 @@ sf_tail:
LEX *lex= thd->lex;
Lex_input_stream *lip= YYLIP;
+ lex->sphead->set_chistics(lex->sp_chistics);
lex->sphead->set_body_start(thd, lip->get_cpp_tok_start());
}
sp_tail_is
@@ -16947,6 +16947,7 @@ sp_tail:
opt_sp_parenthesized_pdparam_list
sp_c_chistics
{
+ Lex->sphead->set_chistics(Lex->sp_chistics);
Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start());
}
sp_tail_is
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 40a0e4f00a6..87eb97e4fec 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -2253,7 +2253,7 @@ static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len)
sp->m_params.str, sp->m_params.length,
retstr.c_ptr(), retstr.length(),
sp->m_body.str, sp->m_body.length,
- sp->m_chistics, &(thd->lex->definer->user),
+ sp->chistics(), &(thd->lex->definer->user),
&(thd->lex->definer->host),
saved_mode))
{