summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-07-30 19:02:21 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2007-07-30 19:02:21 +0300
commite5fd6b3c71d3ac5c0d0f2d46cdc301dc99390022 (patch)
tree7da108a5ff817f9b4aec681922a904983e5f804b /sql/sql_insert.cc
parentc0b65fb77dcb7010056dff7e476b7397dd912c89 (diff)
parent1307d3b8033985d842b900ec8ebe7be9f0a4e092 (diff)
downloadmariadb-git-e5fd6b3c71d3ac5c0d0f2d46cdc301dc99390022.tar.gz
(Pushing for Andrei)
Merge magare.gmz:/home/kgeorge/mysql/work/B27417-5.0-opt into magare.gmz:/home/kgeorge/mysql/work/B27417-5.1-opt mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_table.cc: Auto merged mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test: merge of bug 27471 from 5.0-opt to 5.1-opt sql/log.cc: merge of bug 27471 from 5.0-opt to 5.1-opt sql/set_var.cc: merge of bug 27471 from 5.0-opt to 5.1-opt sql/sp_head.cc: merge of bug 27471 from 5.0-opt to 5.1-opt sql/sql_delete.cc: merge of bug 27471 from 5.0-opt to 5.1-opt sql/sql_insert.cc: merge of bug 27471 from 5.0-opt to 5.1-opt sql/sql_load.cc: merge of bug 27471 from 5.0-opt to 5.1-opt sql/sql_parse.cc: merge of bug 27471 from 5.0-opt to 5.1-opt sql/sql_update.cc: merge of bug 27471 from 5.0-opt to 5.1-opt
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc34
1 files changed, 14 insertions, 20 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 445cabbd9b8..d77661ad367 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -713,7 +713,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode)
table->file->ha_start_bulk_insert(values_list.elements);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES)));
@@ -883,10 +882,12 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
error=1;
}
}
- if (!transactional_table && changed)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
}
+ DBUG_ASSERT(transactional_table || !changed ||
+ thd->transaction.stmt.modified_non_trans_table);
if (transactional_table)
error=ha_autocommit_or_rollback(thd,error);
@@ -1296,7 +1297,7 @@ static int last_uniq_key(TABLE *table,uint keynr)
then both on update triggers will work instead. Similarly both on
delete triggers will be invoked if we will delete conflicting records.
- Sets thd->no_trans_update.stmt to TRUE if table which is updated didn't have
+ Sets thd->transaction.stmt.modified_non_trans_table to TRUE if table which is updated didn't have
transactions.
RETURN VALUE
@@ -1516,7 +1517,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
goto err;
info->deleted++;
if (!table->file->has_transactions())
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, TRUE))
@@ -1557,7 +1558,7 @@ ok_or_after_trg_err:
if (key)
my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
if (!table->file->has_transactions())
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
DBUG_RETURN(trg_error);
err:
@@ -2922,7 +2923,6 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
if (info.handle_duplicates == DUP_UPDATE)
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
@@ -3071,6 +3071,7 @@ bool select_insert::send_eof()
int error;
bool const trans_table= table->file->has_transactions();
ulonglong id;
+ bool changed;
DBUG_ENTER("select_insert::send_eof");
DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'",
trans_table, table->file->table_type()));
@@ -3079,24 +3080,18 @@ bool select_insert::send_eof()
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
- if (info.copied || info.deleted || info.updated)
+ if (changed= (info.copied || info.deleted || info.updated))
{
/*
We must invalidate the table in the query cache before binlog writing
and ha_autocommit_or_rollback.
*/
query_cache_invalidate3(thd, table, 1);
- /*
- Mark that we have done permanent changes if all of the below is true
- - Table doesn't support transactions
- - It's a normal (not temporary) table. (Changes to temporary tables
- are not logged in RBR)
- - We are using statement based replication
- */
- if (!trans_table &&
- (!table->s->tmp_table || !thd->current_stmt_binlog_row_based))
- thd->no_trans_update.all= TRUE;
- }
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
+ }
+ DBUG_ASSERT(trans_table || !changed ||
+ thd->transaction.stmt.modified_non_trans_table);
/*
Write to binlog before commiting transaction. No statement will
@@ -3517,7 +3512,6 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
if (!thd->prelocked_mode)
table->file->ha_start_bulk_insert((ha_rows) 0);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |