summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2005-05-31 14:37:47 +0200
committerunknown <tomas@poseidon.ndb.mysql.com>2005-05-31 14:37:47 +0200
commitaba391dd344e99aaa1625677f2b394e506980ebf (patch)
tree7c45fd5243b3cfbcdac69f6a06c9b1ae00ddc11e /sql/sql_load.cc
parent8128e3e417e15489f61ad783182d7affc579330a (diff)
parentb1480cc00d7d5dcea716e422567495c96f6f5736 (diff)
downloadmariadb-git-aba391dd344e99aaa1625677f2b394e506980ebf.tar.gz
Merge
BitKeeper/etc/logging_ok: auto-union Makefile.am: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/information_schema_db.result: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_federated.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/ha_myisammrg.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_udf.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/unireg.cc: Auto merged storage/innobase/row/row0mysql.c: Auto merged storage/innobase/srv/srv0start.c: Auto merged storage/innobase/trx/trx0trx.c: Auto merged storage/myisam/rt_split.c: Auto merged storage/myisammrg/myrg_open.c: Auto merged storage/ndb/src/common/debugger/SignalLoggerManager.cpp: Auto merged storage/ndb/src/common/util/File.cpp: Auto merged storage/ndb/src/cw/cpcd/Process.cpp: Auto merged storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: Auto merged storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp: Auto merged storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: Auto merged sql/sql_delete.cc: merge sql/sql_update.cc: merge sql/table.cc: SCCS merged support-files/mysql.spec.sh: merge
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc32
1 files changed, 23 insertions, 9 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 880fbb62c13..72fa7880268 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -21,6 +21,8 @@
#include <my_dir.h>
#include <m_ctype.h>
#include "sql_repl.h"
+#include "sp_head.h"
+#include "sql_trigger.h"
class READ_INFO {
File file;
@@ -148,7 +150,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(TRUE);
if (setup_tables(thd, table_list, &unused_conds,
- &thd->lex->select_lex.leaf_tables, FALSE, FALSE))
+ &thd->lex->select_lex.leaf_tables, FALSE))
DBUG_RETURN(-1);
if (!table_list->table || // do not suport join view
!table_list->updatable || // and derived tables
@@ -579,7 +581,11 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
ER(ER_WARN_TOO_MANY_RECORDS), thd->row_count);
}
- if (fill_record(thd, set_fields, set_values, ignore_check_option_errors))
+ if (thd->killed ||
+ fill_record_n_invoke_before_triggers(thd, set_fields, set_values,
+ ignore_check_option_errors,
+ table->triggers,
+ TRG_EVENT_INSERT))
DBUG_RETURN(1);
switch (table_list->view_check_option(thd,
@@ -591,7 +597,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
DBUG_RETURN(-1);
}
- if (thd->killed || write_record(thd,table,&info))
+ if (write_record(thd, table, &info))
DBUG_RETURN(1);
thd->no_trans_update= no_trans_update;
@@ -603,8 +609,10 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
*/
if (!id && thd->insert_id_used)
id= thd->last_insert_id;
- if (table->next_number_field)
- table->next_number_field->reset(); // Clear for next record
+ /*
+ We don't need to reset auto-increment field since we are restoring
+ its default value at the beginning of each loop iteration.
+ */
if (read_info.next_line()) // Skip to next line
break;
if (read_info.line_cuted)
@@ -736,7 +744,11 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
}
}
- if (fill_record(thd, set_fields, set_values, ignore_check_option_errors))
+ if (thd->killed ||
+ fill_record_n_invoke_before_triggers(thd, set_fields, set_values,
+ ignore_check_option_errors,
+ table->triggers,
+ TRG_EVENT_INSERT))
DBUG_RETURN(1);
switch (table_list->view_check_option(thd,
@@ -749,7 +761,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
}
- if (thd->killed || write_record(thd, table, &info))
+ if (write_record(thd, table, &info))
DBUG_RETURN(1);
/*
If auto_increment values are used, save the first one
@@ -759,8 +771,10 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
*/
if (!id && thd->insert_id_used)
id= thd->last_insert_id;
- if (table->next_number_field)
- table->next_number_field->reset(); // Clear for next record
+ /*
+ We don't need to reset auto-increment field since we are restoring
+ its default value at the beginning of each loop iteration.
+ */
thd->no_trans_update= no_trans_update;
if (read_info.next_line()) // Skip to next line
break;