summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-04-20 15:25:55 +0200
committerSergei Golubchik <serg@mariadb.org>2016-04-20 15:25:55 +0200
commitb069d19284b70ead3ceb62618acdc8ef93a2703e (patch)
tree0d5f6764825d51db3b8a37c8043d837c06e3e086 /sql/sql_update.cc
parent1bc0b0b5245977172e2c3a3c64a42a2c4e762e06 (diff)
parente7061f7e5a96c66cb2e0bf46bec7f6ff35801a69 (diff)
downloadmariadb-git-b069d19284b70ead3ceb62618acdc8ef93a2703e.tar.gz
Merge branch 'mysql/5.5' into 5.5
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc28
1 files changed, 21 insertions, 7 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 91cb5722f44..d1b6e945b23 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2011, 2013, Monty Program Ab.
+/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
+ Copyright (c) 2011, 2016, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -774,7 +774,8 @@ int mysql_update(THD *thd,
error= 0;
}
else if (!ignore ||
- table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
+ table->file->is_fatal_error(error, HA_CHECK_DUP_KEY |
+ HA_CHECK_FK_ERROR))
{
/*
If (ignore && error is ignorable) we don't have to
@@ -782,7 +783,8 @@ int mysql_update(THD *thd,
*/
myf flags= 0;
- if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
+ if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY |
+ HA_CHECK_FK_ERROR))
flags|= ME_FATALERROR; /* Other handler errors are fatal */
prepare_record_for_error_message(error, table);
@@ -790,6 +792,9 @@ int mysql_update(THD *thd,
error= 1;
break;
}
+ else if (ignore && !table->file->is_fatal_error(error,
+ HA_CHECK_FK_ERROR))
+ warn_fk_constraint_violation(thd, table, error);
}
if (table->triggers &&
@@ -1969,7 +1974,8 @@ int multi_update::send_data(List<Item> &not_used_values)
{
updated--;
if (!ignore ||
- table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
+ table->file->is_fatal_error(error, HA_CHECK_DUP_KEY |
+ HA_CHECK_FK_ERROR))
{
/*
If (ignore && error == is ignorable) we don't have to
@@ -1977,13 +1983,17 @@ int multi_update::send_data(List<Item> &not_used_values)
*/
myf flags= 0;
- if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
+ if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY |
+ HA_CHECK_FK_ERROR))
flags|= ME_FATALERROR; /* Other handler errors are fatal */
prepare_record_for_error_message(error, table);
table->file->print_error(error,MYF(flags));
DBUG_RETURN(1);
}
+ else if (ignore && !table->file->is_fatal_error(error,
+ HA_CHECK_FK_ERROR))
+ warn_fk_constraint_violation(thd, table, error);
}
else
{
@@ -2256,11 +2266,15 @@ int multi_update::do_updates()
local_error != HA_ERR_RECORD_IS_THE_SAME)
{
if (!ignore ||
- table->file->is_fatal_error(local_error, HA_CHECK_DUP_KEY))
+ table->file->is_fatal_error(local_error, HA_CHECK_DUP_KEY |
+ HA_CHECK_FK_ERROR))
{
err_table= table;
goto err;
}
+ else if (ignore && !table->file->is_fatal_error(local_error,
+ HA_CHECK_FK_ERROR))
+ warn_fk_constraint_violation(thd, table, local_error);
}
if (local_error != HA_ERR_RECORD_IS_THE_SAME)
updated++;