summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-04-20 18:27:23 +0200
committerSergei Golubchik <serg@mariadb.org>2016-04-20 18:27:23 +0200
commit24ac546d0f16d5f56b11c068e4f187a9c4c56bd0 (patch)
tree0ce4470aa683f8109963f71760f23a6711ec05ab /sql/sql_insert.cc
parent9e826bfa36a57f10540ca6ea649cb450add48cf4 (diff)
downloadmariadb-git-24ac546d0f16d5f56b11c068e4f187a9c4c56bd0.tar.gz
use consistent error messaging for IGNORE
1. the same message text for INSERT and INSERT IGNORE 2. no new warnings in UPDATE IGNORE yet (big change for 5.5) and replace a commonly used expression with a named constant
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 7e3a898b3da..c60ef6fcc6e 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1609,9 +1609,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
else
table->file->insert_id_for_cur_row= insert_id_for_cur_row;
bool is_duplicate_key_error;
- if (table->file->is_fatal_error(error, HA_CHECK_DUP | HA_CHECK_FK_ERROR))
+ if (table->file->is_fatal_error(error, HA_CHECK_ALL))
goto err;
- is_duplicate_key_error= table->file->is_fatal_error(error, 0);
+ is_duplicate_key_error=
+ table->file->is_fatal_error(error, HA_CHECK_ALL & ~HA_CHECK_DUP);
if (!is_duplicate_key_error)
{
/*
@@ -1712,8 +1713,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
error != HA_ERR_RECORD_IS_THE_SAME)
{
if (info->ignore &&
- !table->file->is_fatal_error(error, HA_CHECK_DUP_KEY |
- HA_CHECK_FK_ERROR))
+ !table->file->is_fatal_error(error, HA_CHECK_ALL))
{
if (!(thd->variables.old_behavior &
OLD_MODE_NO_DUP_KEY_WARNINGS_WITH_IGNORE))
@@ -1845,7 +1845,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
{
DEBUG_SYNC(thd, "write_row_noreplace");
if (!info->ignore ||
- table->file->is_fatal_error(error, HA_CHECK_DUP | HA_CHECK_FK_ERROR))
+ table->file->is_fatal_error(error, HA_CHECK_ALL))
goto err;
if (!(thd->variables.old_behavior &
OLD_MODE_NO_DUP_KEY_WARNINGS_WITH_IGNORE))
@@ -1866,9 +1866,6 @@ ok_or_after_trg_err:
my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
if (!table->file->has_transactions())
thd->transaction.stmt.modified_non_trans_table= TRUE;
- if (info->ignore &&
- !table->file->is_fatal_error(error, HA_CHECK_FK_ERROR))
- warn_fk_constraint_violation(thd, table, error);
DBUG_RETURN(trg_error);
err: