summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorunknown <mhansson@dl145s.mysql.com>2007-06-27 14:02:32 +0200
committerunknown <mhansson@dl145s.mysql.com>2007-06-27 14:02:32 +0200
commit00b3d3c245e0270dcc55378686dd29e0c181af92 (patch)
tree269fc9a87ef268b467d1150583812a6bc0894708 /sql/sql_insert.cc
parent39ef7a533ed82a2a686ec46bbdfec206d4520520 (diff)
parent3d31e3d641ed8a4420546449e5e25dcafe51f22f (diff)
downloadmariadb-git-00b3d3c245e0270dcc55378686dd29e0c181af92.tar.gz
Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into dl145s.mysql.com:/dev/shm/mhansson/my50-bug28677 sql/sql_class.h: Auto merged sql/sql_insert.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc92
1 files changed, 51 insertions, 41 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 228fc8860ae..9e094c31dce 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -2892,41 +2892,6 @@ void select_insert::send_error(uint errcode,const char *err)
my_message(errcode, err, MYF(0));
- if (!table)
- {
- /*
- This can only happen when using CREATE ... SELECT and the table was not
- created becasue of an syntax error
- */
- DBUG_VOID_RETURN;
- }
- if (!thd->prelocked_mode)
- table->file->end_bulk_insert();
- /*
- 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 || info.updated) &&
- !table->file->has_transactions())
- {
- if (last_insert_id)
- thd->insert_id(last_insert_id); // For binary log
- if (mysql_bin_log.is_open())
- {
- Query_log_event qinfo(thd, thd->query, thd->query_length,
- table->file->has_transactions(), FALSE);
- mysql_bin_log.write(&qinfo);
- }
- if (!table->s->tmp_table)
- thd->no_trans_update.all= TRUE;
- }
- if (info.copied || info.deleted || info.updated)
- {
- query_cache_invalidate3(thd, table, 1);
- }
- ha_rollback_stmt(thd);
DBUG_VOID_RETURN;
}
@@ -2984,6 +2949,49 @@ bool select_insert::send_eof()
DBUG_RETURN(0);
}
+void select_insert::abort()
+{
+ DBUG_ENTER("select_insert::abort");
+
+ if (!table)
+ {
+ /*
+ This can only happen when using CREATE ... SELECT and the table was not
+ created becasue of an syntax error
+ */
+ DBUG_VOID_RETURN;
+ }
+ if (!thd->prelocked_mode)
+ table->file->end_bulk_insert();
+ /*
+ 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 || info.updated) &&
+ !table->file->has_transactions())
+ {
+ if (last_insert_id)
+ thd->insert_id(last_insert_id); // For binary log
+ if (mysql_bin_log.is_open())
+ {
+ Query_log_event qinfo(thd, thd->query, thd->query_length,
+ table->file->has_transactions(), FALSE);
+ mysql_bin_log.write(&qinfo);
+ }
+ if (!table->s->tmp_table)
+ thd->no_trans_update.all= TRUE;
+ }
+ if (info.copied || info.deleted || info.updated)
+ {
+ query_cache_invalidate3(thd, table, 1);
+ }
+ ha_rollback_stmt(thd);
+
+ DBUG_VOID_RETURN;
+
+}
/***************************************************************************
CREATE TABLE (SELECT) ...
@@ -3241,13 +3249,7 @@ void select_create::store_values(List<Item> &values)
void select_create::send_error(uint errcode,const char *err)
{
- /*
- Disable binlog, because we "roll back" partial inserts in ::abort
- by removing the table, even for non-transactional tables.
- */
- tmp_disable_binlog(thd);
select_insert::send_error(errcode, err);
- reenable_binlog(thd);
}
@@ -3272,6 +3274,14 @@ bool select_create::send_eof()
void select_create::abort()
{
+ /*
+ Disable binlog, because we "roll back" partial inserts in ::abort
+ by removing the table, even for non-transactional tables.
+ */
+ tmp_disable_binlog(thd);
+ select_insert::abort();
+ reenable_binlog(thd);
+
if (lock)
{
mysql_unlock_tables(thd, lock);