diff options
author | unknown <monty@narttu.mysql.fi> | 2003-06-04 19:21:51 +0300 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-06-04 19:21:51 +0300 |
commit | 13f7e49494559bba3195ccf3abdb349fbe79b6dc (patch) | |
tree | 6b8e47374bf313429416a26678bc409946f34772 /sql/sql_insert.cc | |
parent | b388eb004df7112b2ae0986457fc9d01131b71ea (diff) | |
parent | b5860aed7b1d11f2d3ac909cde1438c86af26cb5 (diff) | |
download | mariadb-git-13f7e49494559bba3195ccf3abdb349fbe79b6dc.tar.gz |
Merge with 4.0.13
BitKeeper/etc/logging_ok:
auto-union
BUILD/SETUP.sh:
Auto merged
BitKeeper/deleted/.del-internals.texi~62b6f580a41c2a43:
Auto merged
client/mysqltest.c:
Auto merged
include/config-win.h:
Auto merged
include/my_global.h:
Auto merged
include/mysql_com.h:
Auto merged
innobase/include/srv0srv.h:
Auto merged
innobase/log/log0log.c:
Auto merged
innobase/os/os0file.c:
Auto merged
innobase/srv/srv0srv.c:
Auto merged
innobase/srv/srv0start.c:
Auto merged
innobase/ut/ut0mem.c:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/alter_table.result:
Auto merged
mysql-test/r/errors.result:
Auto merged
mysql-test/r/loaddata.result:
Auto merged
mysql-test/r/rpl_insert_id.result:
Auto merged
mysql-test/r/rpl_loaddata.result:
Auto merged
mysql-test/std_data/rpl_loaddata2.dat:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
mysql-test/t/loaddata.test:
Auto merged
mysql-test/t/query_cache.test:
Auto merged
mysql-test/t/raid.test:
Auto merged
mysql-test/t/rpl_insert_id.test:
Auto merged
mysql-test/t/rpl_loaddata.test:
Auto merged
sql/field.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/sql_cache.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/time.cc:
Auto merged
configure.in:
No changes
libmysqld/lib_sql.cc:
No changes
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 1908f898a27..69382b2db95 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1421,6 +1421,24 @@ void select_insert::send_error(uint errcode,const char *err) ::send_error(thd,errcode,err); table->file->extra(HA_EXTRA_NO_CACHE); table->file->activate_all_index(thd); + /* + If at least one row has been inserted/modified and will stay in the table + (the table doesn't have transactions) (example: we got a duplicate key + error while inserting into a MyISAM table) we must write to the binlog (and + the error code will make the slave stop). + */ + if ((info.copied || info.deleted) && !table->file->has_transactions()) + { + if (last_insert_id) + thd->insert_id(last_insert_id); // For binary log + mysql_update_log.write(thd,thd->query,thd->query_length); + if (mysql_bin_log.is_open()) + { + Query_log_event qinfo(thd, thd->query, thd->query_length, + table->file->has_transactions()); + mysql_bin_log.write(&qinfo); + } + } if (info.copied || info.deleted) query_cache_invalidate3(thd, table, 1); ha_rollback_stmt(thd); @@ -1442,7 +1460,10 @@ bool select_insert::send_eof() if (info.copied || info.deleted) query_cache_invalidate3(thd, table, 1); + if (last_insert_id) + thd->insert_id(last_insert_id); // For binary log /* Write to binlog before commiting transaction */ + mysql_update_log.write(thd,thd->query,thd->query_length); if (mysql_bin_log.is_open()) { Query_log_event qinfo(thd, thd->query, thd->query_length, @@ -1467,10 +1488,7 @@ bool select_insert::send_eof() else sprintf(buff,ER(ER_INSERT_INFO),info.records,info.deleted, thd->cuted_fields); - if (last_insert_id) - thd->insert_id(last_insert_id); // For update log ::send_ok(thd,info.copied+info.deleted,last_insert_id,buff); - mysql_update_log.write(thd,thd->query,thd->query_length); return 0; } } |