1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Applied all changes from Igor and Sanja

This commit is contained in:
Michael Widenius
2013-06-15 18:32:08 +03:00
parent 3143ad589a
commit 5f1f2fc0e4
162 changed files with 11704 additions and 6298 deletions

View File

@ -157,7 +157,7 @@ Trigger_creation_ctx::create(THD *thd,
if (invalid_creation_ctx)
{
push_warning_printf(thd,
MYSQL_ERROR::WARN_LEVEL_WARN,
Sql_condition::WARN_LEVEL_WARN,
ER_TRG_INVALID_CREATION_CTX,
ER(ER_TRG_INVALID_CREATION_CTX),
(const char *) db_name,
@ -329,9 +329,9 @@ public:
virtual bool handle_condition(THD *thd,
uint sql_errno,
const char* sqlstate,
MYSQL_ERROR::enum_warning_level level,
Sql_condition::enum_warning_level level,
const char* message,
MYSQL_ERROR ** cond_hdl)
Sql_condition ** cond_hdl)
{
if (sql_errno != EE_OUTOFMEMORY &&
sql_errno != ER_OUT_OF_RESOURCES)
@ -561,7 +561,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
if (result)
goto end;
close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED);
close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL);
/*
Reopen the table if we were under LOCK TABLES.
Ignore the return value for now. It's better to
@ -588,7 +588,7 @@ end:
with the implicit commit.
*/
if (thd->locked_tables_mode && tables && lock_upgrade_done)
mdl_ticket->downgrade_exclusive_lock(MDL_SHARED_NO_READ_WRITE);
mdl_ticket->downgrade_lock(MDL_SHARED_NO_READ_WRITE);
/* Restore the query table list. Used only for drop trigger. */
if (!create)
@ -802,7 +802,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
lex->definer->user.str))
{
push_warning_printf(thd,
MYSQL_ERROR::WARN_LEVEL_NOTE,
Sql_condition::WARN_LEVEL_NOTE,
ER_NO_SUCH_USER,
ER(ER_NO_SUCH_USER),
lex->definer->user.str,
@ -1277,7 +1277,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
DBUG_RETURN(1); // EOM
}
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRG_NO_CREATION_CTX,
ER(ER_TRG_NO_CREATION_CTX),
(const char*) db,
@ -1461,7 +1461,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
warning here.
*/
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_TRG_NO_DEFINER, ER(ER_TRG_NO_DEFINER),
(const char*) db,
(const char*) sp->m_name.str);
@ -1734,7 +1734,7 @@ bool add_table_for_trigger(THD *thd,
if (if_exists)
{
push_warning_printf(thd,
MYSQL_ERROR::WARN_LEVEL_NOTE,
Sql_condition::WARN_LEVEL_NOTE,
ER_TRG_DOES_NOT_EXIST,
ER(ER_TRG_DOES_NOT_EXIST));
@ -2213,6 +2213,37 @@ add_tables_and_routines_for_triggers(THD *thd,
}
/**
Check if any of the marked fields are used in the trigger.
@param used_fields Bitmap over fields to check
@param event_type Type of event triggers for which we are going to inspect
@param action_time Type of trigger action time we are going to inspect
*/
bool Table_triggers_list::is_fields_updated_in_trigger(MY_BITMAP *used_fields,
trg_event_type event_type,
trg_action_time_type action_time)
{
Item_trigger_field *trg_field;
sp_head *sp= bodies[event_type][action_time];
DBUG_ASSERT(used_fields->n_bits == trigger_table->s->fields);
for (trg_field= sp->m_trg_table_fields.first; trg_field;
trg_field= trg_field->next_trg_field)
{
/* We cannot check fields which does not present in table. */
if (trg_field->field_idx != (uint)-1)
{
if (bitmap_is_set(used_fields, trg_field->field_idx) &&
trg_field->get_settable_routine_parameter())
return true;
}
}
return false;
}
/**
Mark fields of subject table which we read/set in its triggers
as such.
@ -2305,7 +2336,7 @@ Handle_old_incorrect_sql_modes_hook::process_unknown_string(char *&unknown_key,
DBUG_PRINT("info", ("sql_modes affected by BUG#14090 detected"));
push_warning_printf(current_thd,
MYSQL_ERROR::WARN_LEVEL_NOTE,
Sql_condition::WARN_LEVEL_NOTE,
ER_OLD_FILE_FORMAT,
ER(ER_OLD_FILE_FORMAT),
(char *)path, "TRIGGER");
@ -2346,7 +2377,7 @@ process_unknown_string(char *&unknown_key, uchar* base, MEM_ROOT *mem_root,
DBUG_PRINT("info", ("trigger_table affected by BUG#15921 detected"));
push_warning_printf(current_thd,
MYSQL_ERROR::WARN_LEVEL_NOTE,
Sql_condition::WARN_LEVEL_NOTE,
ER_OLD_FILE_FORMAT,
ER(ER_OLD_FILE_FORMAT),
(char *)path, "TRIGGER");