diff options
author | unknown <monty@mysql.com> | 2004-12-31 12:04:35 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-12-31 12:04:35 +0200 |
commit | 2419fa2684413f103a5bee470a330f00310c3f6e (patch) | |
tree | 15ba897ee442fcca24c0923eecba6bd94786608f /sql/log_event.cc | |
parent | 7a3ad6eb8422b28e8f15aa873393001fac193963 (diff) | |
download | mariadb-git-2419fa2684413f103a5bee470a330f00310c3f6e.tar.gz |
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
This allows use to use INSERT IGNORE ... ON DUPLICATE ...
mysql-test/r/drop.result:
safety fix
mysql-test/t/drop.test:
safety fix
mysql-test/t/multi_update.test:
ensure we cover all possible errors
sql/log_event.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/log_event.h:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/mysql_priv.h:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_class.h:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_delete.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_insert.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_lex.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_lex.h:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_load.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_parse.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_repl.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_repl.h:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_select.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_table.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_union.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_update.cc:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
sql/sql_yacc.yy:
Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index c027c3a8ee4..04395f121fd 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1418,7 +1418,7 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex, const char *db_arg, const char *table_name_arg, List<Item> &fields_arg, enum enum_duplicates handle_dup, - bool using_trans) + bool ignore, bool using_trans) :Log_event(thd_arg, !thd_arg->tmp_table_used ? 0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans), thread_id(thd_arg->thread_id), @@ -1456,9 +1456,6 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex, sql_ex.empty_flags= 0; switch (handle_dup) { - case DUP_IGNORE: - sql_ex.opt_flags|= IGNORE_FLAG; - break; case DUP_REPLACE: sql_ex.opt_flags|= REPLACE_FLAG; break; @@ -1466,6 +1463,8 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex, case DUP_ERROR: break; } + if (ignore) + sql_ex.opt_flags|= IGNORE_FLAG; if (!ex->field_term->length()) sql_ex.empty_flags |= FIELD_TERM_EMPTY; @@ -1791,6 +1790,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, { char llbuff[22]; enum enum_duplicates handle_dup; + bool ignore= 0; /* Make a simplified LOAD DATA INFILE query, for the information of the user in SHOW PROCESSLIST. Note that db is known in the 'db' column. @@ -1807,21 +1807,24 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, if (sql_ex.opt_flags & REPLACE_FLAG) handle_dup= DUP_REPLACE; else if (sql_ex.opt_flags & IGNORE_FLAG) - handle_dup= DUP_IGNORE; + { + ignore= 1; + handle_dup= DUP_ERROR; + } else { /* When replication is running fine, if it was DUP_ERROR on the - master then we could choose DUP_IGNORE here, because if DUP_ERROR + master then we could choose IGNORE here, because if DUP_ERROR suceeded on master, and data is identical on the master and slave, - then there should be no uniqueness errors on slave, so DUP_IGNORE is + then there should be no uniqueness errors on slave, so IGNORE is the same as DUP_ERROR. But in the unlikely case of uniqueness errors (because the data on the master and slave happen to be different (user error or bug), we want LOAD DATA to print an error message on the slave to discover the problem. If reading from net (a 3.23 master), mysql_load() will change this - to DUP_IGNORE. + to IGNORE. */ handle_dup= DUP_ERROR; } @@ -1855,7 +1858,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, */ thd->net.pkt_nr = net->pkt_nr; } - if (mysql_load(thd, &ex, &tables, field_list, handle_dup, net != 0, + if (mysql_load(thd, &ex, &tables, field_list, handle_dup, ignore, net != 0, TL_WRITE)) thd->query_error = 1; if (thd->cuted_fields) @@ -2747,8 +2750,9 @@ Create_file_log_event:: Create_file_log_event(THD* thd_arg, sql_exchange* ex, const char* db_arg, const char* table_name_arg, List<Item>& fields_arg, enum enum_duplicates handle_dup, + bool ignore, char* block_arg, uint block_len_arg, bool using_trans) - :Load_log_event(thd_arg,ex,db_arg,table_name_arg,fields_arg,handle_dup, + :Load_log_event(thd_arg,ex,db_arg,table_name_arg,fields_arg,handle_dup, ignore, using_trans), fake_base(0), block(block_arg), event_buf(0), block_len(block_len_arg), file_id(thd_arg->file_id = mysql_bin_log.next_file_id()) |