Commit edaf33a1 authored by unknown's avatar unknown

BUG#6662: Importing mysqldumps should not show any warnings of level "notes".

parent 96f9c9d9
......@@ -492,6 +492,8 @@ static void write_header(FILE *sql_file, char *db_name)
"/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='%s%s%s' */;\n",
path?"":"NO_AUTO_VALUE_ON_ZERO",compatible_mode_normal_str[0]==0?"":",",
compatible_mode_normal_str);
fprintf(sql_file,
"/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n");
check_io(sql_file);
}
} /* write_header */
......@@ -518,6 +520,8 @@ static void write_footer(FILE *sql_file)
"/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n"
"/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n"
"/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
fprintf(sql_file,
"/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;");
fputs("\n", sql_file);
check_io(sql_file);
}
......
This diff is collapsed.
......@@ -212,6 +212,10 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define OPTION_RELAXED_UNIQUE_CHECKS (1L << 27)
#define SELECT_NO_UNLOCK (1L << 28)
/* If set to 0, then the thread will ignore all warnings with level notes.
Set by executing SET SHOW_NOTES=1 */
#define OPTION_NOTES (1L << 31)
/* Bits for different SQL modes modes (including ANSI mode) */
#define MODE_REAL_AS_FLOAT 1
#define MODE_PIPES_AS_CONCAT 2
......
......@@ -5622,7 +5622,8 @@ static void mysql_init_variables(void)
language_ptr= language;
mysql_data_home= mysql_real_data_home;
thd_startup_options= (OPTION_UPDATE_LOG | OPTION_AUTO_IS_NULL |
OPTION_BIN_LOG | OPTION_QUOTE_SHOW_CREATE);
OPTION_BIN_LOG | OPTION_QUOTE_SHOW_CREATE |
OPTION_NOTES);
protocol_version= PROTOCOL_VERSION;
what_to_log= ~ (1L << (uint) COM_TIME);
refresh_version= flush_version= 1L; /* Increments on each reload */
......
......@@ -423,6 +423,9 @@ static sys_var_thd_bit sys_log_binlog("sql_log_bin",
static sys_var_thd_bit sys_sql_warnings("sql_warnings", 0,
set_option_bit,
OPTION_WARNINGS);
static sys_var_thd_bit sys_sql_notes("sql_notes", 0,
set_option_bit,
OPTION_NOTES);
static sys_var_thd_bit sys_auto_is_null("sql_auto_is_null", 0,
set_option_bit,
OPTION_AUTO_IS_NULL);
......@@ -610,6 +613,7 @@ sys_var *sys_variables[]=
&sys_sql_max_join_size,
&sys_sql_mode,
&sys_sql_warnings,
&sys_sql_notes,
&sys_storage_engine,
#ifdef HAVE_REPLICATION
&sys_sync_binlog_period,
......
......@@ -104,6 +104,10 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
{
MYSQL_ERROR *err= 0;
DBUG_ENTER("push_warning");
if (level == MYSQL_ERROR::WARN_LEVEL_NOTE && !(thd->options & OPTION_NOTES))
return(0);
if (thd->query_id != thd->warn_id)
mysql_reset_errors(thd);
......
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