diff options
author | unknown <monty@donna.mysql.com> | 2000-12-24 15:22:33 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-12-24 15:22:33 +0200 |
commit | 967c1b04c0cfedbb618083ac0874602fd67ed954 (patch) | |
tree | decaf5525533d4b56d277f4507959de40b717e13 /sql/sql_insert.cc | |
parent | 25e911fa5e6ae6389231bffd6e64f9bd292aa3bc (diff) | |
parent | 78cf07c8ea126fc03706988de23893ca4680ac77 (diff) | |
download | mariadb-git-967c1b04c0cfedbb618083ac0874602fd67ed954.tar.gz |
merge
configure.in:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index c10e2a205b8..bc67a7f261f 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -190,6 +190,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, error=0; id=0; thd->proc_info="update"; + if (duplic == DUP_IGNORE || duplic == DUP_REPLACE) + table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); while ((values = its++)) { if (fields.elements || !value_count) @@ -281,6 +283,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, table->next_number_field=0; thd->count_cuted_fields=0; thd->next_insert_id=0; // Reset this if wrongly used + if (duplic == DUP_IGNORE || duplic == DUP_REPLACE) + table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); if (error) goto abort; @@ -1057,6 +1061,7 @@ bool delayed_insert::handle_inserts(void) { int error; uint max_rows; + bool using_ignore=0; DBUG_ENTER("handle_inserts"); /* Allow client to insert new rows */ @@ -1097,6 +1102,12 @@ bool delayed_insert::handle_inserts(void) table->time_stamp=row->time_stamp; info.handle_duplicates= row->dup; + if (info.handle_duplicates == DUP_IGNORE || + info.handle_duplicates == DUP_REPLACE) + { + table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); + using_ignore=1; + } thd.net.last_errno = 0; // reset error for binlog if (write_record(table,&info)) { @@ -1106,6 +1117,11 @@ bool delayed_insert::handle_inserts(void) pthread_mutex_unlock(&LOCK_delayed_status); row->log_query = 0; } + if (using_ignore) + { + using_ignore=0; + table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); + } if (row->query && row->log_query) { mysql_update_log.write(&thd,row->query, row->query_length); @@ -1193,6 +1209,9 @@ select_insert::prepare(List<Item> &values) thd->cuted_fields=0; if (info.handle_duplicates != DUP_REPLACE) table->file->extra(HA_EXTRA_WRITE_CACHE); + if (info.handle_duplicates == DUP_IGNORE || + info.handle_duplicates == DUP_REPLACE) + table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); table->file->deactivate_non_unique_index((ha_rows) 0); DBUG_RETURN(0); } @@ -1204,6 +1223,7 @@ select_insert::~select_insert() if (save_time_stamp) table->time_stamp=save_time_stamp; table->next_number_field=0; + table->file->extra(HA_EXTRA_RESET); } thd->count_cuted_fields=0; } @@ -1246,6 +1266,7 @@ bool select_insert::send_eof() int error,error2; if (!(error=table->file->extra(HA_EXTRA_NO_CACHE))) error=table->file->activate_all_index(thd); + table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error) error=error2; @@ -1307,6 +1328,9 @@ select_create::prepare(List<Item> &values) restore_record(table,2); // Get empty record thd->count_cuted_fields=1; // count warnings thd->cuted_fields=0; + if (info.handle_duplicates == DUP_IGNORE || + info.handle_duplicates == DUP_REPLACE) + table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); DBUG_RETURN(0); } @@ -1339,6 +1363,7 @@ bool select_create::send_eof() abort(); else { + table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); VOID(pthread_mutex_lock(&LOCK_open)); mysql_unlock_tables(thd, lock); if (!table->tmp_table) @@ -1359,6 +1384,7 @@ void select_create::abort() } if (table) { + table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); enum db_type table_type=table->db_type; if (!table->tmp_table) hash_delete(&open_cache,(byte*) table); |