|
1 | | -/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. |
| 1 | +/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. |
2 | 2 |
|
3 | 3 | This program is free software; you can redistribute it and/or modify |
4 | 4 | it under the terms of the GNU General Public License as published by |
@@ -826,21 +826,26 @@ int mysql_update(THD *thd, |
826 | 826 | error= 0; |
827 | 827 | } |
828 | 828 | else if (!ignore || |
829 | | - table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) |
| 829 | + table->file->is_fatal_error(error, HA_CHECK_DUP_KEY | |
| 830 | + HA_CHECK_FK_ERROR)) |
830 | 831 | { |
831 | 832 | /* |
832 | 833 | If (ignore && error is ignorable) we don't have to |
833 | 834 | do anything; otherwise... |
834 | 835 | */ |
835 | 836 | myf flags= 0; |
836 | 837 |
|
837 | | - if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) |
| 838 | + if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY | |
| 839 | + HA_CHECK_FK_ERROR)) |
838 | 840 | flags|= ME_FATALERROR; /* Other handler errors are fatal */ |
839 | 841 |
|
840 | 842 | table->file->print_error(error,MYF(flags)); |
841 | 843 | error= 1; |
842 | 844 | break; |
843 | 845 | } |
| 846 | + else if (ignore && !table->file->is_fatal_error(error, |
| 847 | + HA_CHECK_FK_ERROR)) |
| 848 | + warn_fk_constraint_violation(thd, table, error); |
844 | 849 | } |
845 | 850 |
|
846 | 851 | if (table->triggers && |
@@ -2073,20 +2078,25 @@ bool multi_update::send_data(List<Item> ¬_used_values) |
2073 | 2078 | { |
2074 | 2079 | updated--; |
2075 | 2080 | if (!ignore || |
2076 | | - table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) |
| 2081 | + table->file->is_fatal_error(error, HA_CHECK_DUP_KEY | |
| 2082 | + HA_CHECK_FK_ERROR)) |
2077 | 2083 | { |
2078 | 2084 | /* |
2079 | 2085 | If (ignore && error == is ignorable) we don't have to |
2080 | 2086 | do anything; otherwise... |
2081 | 2087 | */ |
2082 | 2088 | myf flags= 0; |
2083 | 2089 |
|
2084 | | - if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) |
| 2090 | + if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY | |
| 2091 | + HA_CHECK_FK_ERROR)) |
2085 | 2092 | flags|= ME_FATALERROR; /* Other handler errors are fatal */ |
2086 | 2093 |
|
2087 | 2094 | table->file->print_error(error,MYF(flags)); |
2088 | 2095 | DBUG_RETURN(1); |
2089 | 2096 | } |
| 2097 | + else if (ignore && !table->file->is_fatal_error(error, |
| 2098 | + HA_CHECK_FK_ERROR)) |
| 2099 | + warn_fk_constraint_violation(thd, table, error); |
2090 | 2100 | } |
2091 | 2101 | else |
2092 | 2102 | { |
@@ -2365,8 +2375,12 @@ int multi_update::do_updates() |
2365 | 2375 | else if (local_error == HA_ERR_RECORD_IS_THE_SAME) |
2366 | 2376 | local_error= 0; |
2367 | 2377 | else if (!ignore || |
2368 | | - table->file->is_fatal_error(local_error, HA_CHECK_DUP_KEY)) |
| 2378 | + table->file->is_fatal_error(local_error, HA_CHECK_DUP_KEY | |
| 2379 | + HA_CHECK_FK_ERROR)) |
2369 | 2380 | goto err; |
| 2381 | + else if (ignore && !table->file->is_fatal_error(local_error, |
| 2382 | + HA_CHECK_FK_ERROR)) |
| 2383 | + warn_fk_constraint_violation(thd, table, local_error); |
2370 | 2384 | else |
2371 | 2385 | local_error= 0; |
2372 | 2386 | } |
|
0 commit comments