diff options
author | bell@sanja.is.com.ua <> | 2003-07-01 10:03:20 +0300 |
---|---|---|
committer | bell@sanja.is.com.ua <> | 2003-07-01 10:03:20 +0300 |
commit | f1353c1ddad6dfd021b2a5dd4e2cb44e4b0eb54e (patch) | |
tree | cd54e2149de2b87d2e445802361904126b9c15ef /sql | |
parent | 1c38e1790aa107049708f35db5ecb892650e6296 (diff) | |
parent | 76315814b72c6238712916ec592f408e47f15af2 (diff) | |
download | mariadb-git-f1353c1ddad6dfd021b2a5dd4e2cb44e4b0eb54e.tar.gz |
merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysqld.cc | 22 | ||||
-rw-r--r-- | sql/sql_lex.cc | 3 | ||||
-rw-r--r-- | sql/sql_lex.h | 1 | ||||
-rw-r--r-- | sql/sql_select.cc | 3 |
4 files changed, 21 insertions, 8 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 72ee3e30c63..27fc8ea70ac 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1818,15 +1818,23 @@ extern "C" int my_message_sql(uint error, const char *str, { THD *thd; DBUG_ENTER("my_message_sql"); - DBUG_PRINT("error",("Message: '%s'",str)); - if ((thd=current_thd)) + DBUG_PRINT("error", ("Message: '%s'", str)); + if ((thd= current_thd)) { - NET *net= &thd->net; - net->report_error= 1; - if (!net->last_error[0]) // Return only first message + if (thd->lex.current_select->no_error && !thd->is_fatal_error) { - strmake(net->last_error,str,sizeof(net->last_error)-1); - net->last_errno=error ? error : ER_UNKNOWN_ERROR; + DBUG_PRINT("error", ("above error converted to warning")); + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str); + } + else + { + NET *net= &thd->net; + net->report_error= 1; + if (!net->last_error[0]) // Return only first message + { + strmake(net->last_error, str, sizeof(net->last_error)-1); + net->last_errno= error ? error : ER_UNKNOWN_ERROR; + } } } else diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 1658d5d14c1..2eeb57f34a7 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -122,6 +122,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length) lex->yacc_yyss=lex->yacc_yyvs=0; lex->ignore_space=test(thd->variables.sql_mode & MODE_IGNORE_SPACE); lex->sql_command=SQLCOM_END; + lex->duplicates= DUP_ERROR; return lex; } @@ -965,7 +966,7 @@ void st_select_lex_node::init_query() { options= 0; linkage= UNSPECIFIED_TYPE; - no_table_names_allowed= uncacheable= dependent= 0; + no_error= no_table_names_allowed= uncacheable= dependent= 0; ref_pointer_array= 0; cond_count= 0; } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 5cebddaf02e..faf7e16e54a 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -213,6 +213,7 @@ public: bool dependent; /* dependent from outer select subselect */ bool uncacheable; /* result of this query can't be cached */ bool no_table_names_allowed; /* used for global order by */ + bool no_error; /* suppress error message (convert it to warnings) */ static void *operator new(size_t size) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 31bb8ffc032..f9fc39c2318 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -436,6 +436,9 @@ JOIN::optimize() DBUG_RETURN(0); optimized= 1; + // Ignore errors of execution if option IGNORE present + if (thd->lex.duplicates == DUP_IGNORE) + thd->lex.current_select->no_error= 1; #ifdef HAVE_REF_TO_FIELDS // Not done yet /* Add HAVING to WHERE if possible */ if (having && !group_list && !sum_func_count) |