mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge zim.(none):/home/ian/workspace/mysql-5.0
into zim.(none):/home/ian/workspace/mysql-5.1-new Updated bug message in disabled file -Brian
This commit is contained in:
@ -87,7 +87,7 @@ static File_option trigname_file_parameters[]=
|
||||
{
|
||||
{(char *) STRING_WITH_LEN("trigger_table")},
|
||||
offsetof(struct st_trigname, trigger_table),
|
||||
FILE_OPTIONS_ESTRING
|
||||
FILE_OPTIONS_ESTRING
|
||||
},
|
||||
{ { 0, 0 }, 0, FILE_OPTIONS_STRING }
|
||||
};
|
||||
@ -109,10 +109,6 @@ const LEX_STRING trg_event_type_names[]=
|
||||
|
||||
static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig);
|
||||
|
||||
bool handle_old_incorrect_sql_modes(char *&unknown_key, gptr base,
|
||||
MEM_ROOT *mem_root,
|
||||
char *end, gptr hook_data);
|
||||
|
||||
class Handle_old_incorrect_sql_modes_hook: public Unknown_key_hook
|
||||
{
|
||||
private:
|
||||
@ -125,6 +121,20 @@ public:
|
||||
MEM_ROOT *mem_root, char *end);
|
||||
};
|
||||
|
||||
class Handle_old_incorrect_trigger_table_hook: public Unknown_key_hook
|
||||
{
|
||||
public:
|
||||
Handle_old_incorrect_trigger_table_hook(char *file_path,
|
||||
LEX_STRING *trigger_table_arg)
|
||||
:path(file_path), trigger_table_value(trigger_table_arg)
|
||||
{};
|
||||
virtual bool process_unknown_string(char *&unknown_key, gptr base,
|
||||
MEM_ROOT *mem_root, char *end);
|
||||
private:
|
||||
char *path;
|
||||
LEX_STRING *trigger_table_value;
|
||||
};
|
||||
|
||||
/*
|
||||
Create or drop trigger for table.
|
||||
|
||||
@ -1126,6 +1136,9 @@ static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig)
|
||||
LEX_STRING path;
|
||||
File_parser *parser;
|
||||
struct st_trigname trigname;
|
||||
Handle_old_incorrect_trigger_table_hook trigger_table_hook(
|
||||
path_buff, &trigname.trigger_table);
|
||||
|
||||
DBUG_ENTER("add_table_for_trigger");
|
||||
|
||||
path.length= build_table_filename(path_buff, FN_REFLEN-1,
|
||||
@ -1151,7 +1164,7 @@ static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig)
|
||||
|
||||
if (parser->parse((gptr)&trigname, thd->mem_root,
|
||||
trigname_file_parameters, 1,
|
||||
&file_parser_dummy_hook))
|
||||
&trigger_table_hook))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
/* We need to reset statement table list to be PS/SP friendly. */
|
||||
@ -1541,7 +1554,7 @@ Handle_old_incorrect_sql_modes_hook::process_unknown_string(char *&unknown_key,
|
||||
MEM_ROOT *mem_root,
|
||||
char *end)
|
||||
{
|
||||
DBUG_ENTER("handle_old_incorrect_sql_modes");
|
||||
DBUG_ENTER("Handle_old_incorrect_sql_modes_hook::process_unknown_string");
|
||||
DBUG_PRINT("info", ("unknown key:%60s", unknown_key));
|
||||
|
||||
if (unknown_key + INVALID_SQL_MODES_LENGTH + 1 < end &&
|
||||
@ -1570,3 +1583,44 @@ Handle_old_incorrect_sql_modes_hook::process_unknown_string(char *&unknown_key,
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
Trigger BUG#15921 compatibility hook. For details see
|
||||
Handle_old_incorrect_sql_modes_hook::process_unknown_string().
|
||||
*/
|
||||
|
||||
#define INVALID_TRIGGER_TABLE_LENGTH 15
|
||||
|
||||
bool
|
||||
Handle_old_incorrect_trigger_table_hook::
|
||||
process_unknown_string(char *&unknown_key, gptr base, MEM_ROOT *mem_root,
|
||||
char *end)
|
||||
{
|
||||
DBUG_ENTER("Handle_old_incorrect_trigger_table_hook::process_unknown_string");
|
||||
DBUG_PRINT("info", ("unknown key:%60s", unknown_key));
|
||||
|
||||
if (unknown_key + INVALID_TRIGGER_TABLE_LENGTH + 1 < end &&
|
||||
unknown_key[INVALID_TRIGGER_TABLE_LENGTH] == '=' &&
|
||||
!memcmp(unknown_key, STRING_WITH_LEN("trigger_table")))
|
||||
{
|
||||
char *ptr= unknown_key + INVALID_TRIGGER_TABLE_LENGTH + 1;
|
||||
|
||||
DBUG_PRINT("info", ("trigger_table affected by BUG#15921 detected"));
|
||||
push_warning_printf(current_thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||
ER_OLD_FILE_FORMAT,
|
||||
ER(ER_OLD_FILE_FORMAT),
|
||||
(char *)path, "TRIGGER");
|
||||
|
||||
if (!(ptr= parse_escaped_string(ptr, end, mem_root, trigger_table_value)))
|
||||
{
|
||||
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0), "trigger_table",
|
||||
unknown_key);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/* Set parsing pointer to the last symbol of string (\n). */
|
||||
unknown_key= ptr-1;
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user