mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge 4.1 to 5.0.
BitKeeper/etc/logging_ok: auto-union client/mysql.cc: Auto merged configure.in: Auto merged client/mysqltest.c: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/mysql_com.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged mysql-test/r/insert.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/insert.test: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/query_cache.test: Auto merged sql/ha_innodb.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.cc: Auto merged sql/lex.h: 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/records.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.h: Auto merged sql/share/czech/errmsg.txt: Auto merged sql/share/romanian/errmsg.txt: Auto merged
This commit is contained in:
@ -359,6 +359,8 @@ int mysql_update(THD *thd,
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
if (error <= 0)
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
log_delayed);
|
||||
if (mysql_bin_log.write(&qinfo) && transactional_table)
|
||||
@ -480,7 +482,7 @@ multi_update::multi_update(THD *thd_arg, TABLE_LIST *table_list,
|
||||
:all_tables(table_list), update_tables(0), thd(thd_arg), tmp_tables(0),
|
||||
updated(0), found(0), fields(field_list), values(value_list),
|
||||
table_count(0), copy_field(0), handle_duplicates(handle_duplicates_arg),
|
||||
do_update(1), trans_safe(0)
|
||||
do_update(1), trans_safe(0), transactional_tables(1)
|
||||
{}
|
||||
|
||||
|
||||
@ -584,6 +586,27 @@ int multi_update::prepare(List<Item> ¬_used_values,
|
||||
for (i=0 ; i < table_count ; i++)
|
||||
set_if_bigger(max_fields, fields_for_table[i]->elements);
|
||||
copy_field= new Copy_field[max_fields];
|
||||
|
||||
/*
|
||||
Mark all copies of tables that are updates to ensure that
|
||||
init_read_record() will not try to enable a cache on them
|
||||
|
||||
The problem is that for queries like
|
||||
|
||||
UPDATE t1, t1 AS t2 SET t1.b=t2.c WHERE t1.a=t2.a;
|
||||
|
||||
the row buffer may contain things that doesn't match what is on disk
|
||||
which will cause an error when reading a row.
|
||||
(This issue is mostly relevent for MyISAM tables)
|
||||
*/
|
||||
for (table_ref= all_tables; table_ref; table_ref=table_ref->next)
|
||||
{
|
||||
TABLE *table=table_ref->table;
|
||||
if (!(tables_to_update & table->map) &&
|
||||
find_real_table_in_list(update_tables, table_ref->db,
|
||||
table_ref->real_name))
|
||||
table->no_cache= 1; // Disable row cache
|
||||
}
|
||||
DBUG_RETURN(thd->is_fatal_error != 0);
|
||||
}
|
||||
|
||||
@ -743,7 +766,7 @@ multi_update::~multi_update()
|
||||
{
|
||||
TABLE_LIST *table;
|
||||
for (table= update_tables ; table; table= table->next)
|
||||
table->table->no_keyread=0;
|
||||
table->table->no_keyread= table->table->no_cache= 0;
|
||||
|
||||
if (tmp_tables)
|
||||
{
|
||||
@ -878,8 +901,11 @@ int multi_update::do_updates(bool from_send_error)
|
||||
ha_rows org_updated;
|
||||
TABLE *table;
|
||||
DBUG_ENTER("do_updates");
|
||||
|
||||
|
||||
do_update= 0; // Don't retry this function
|
||||
do_update= 0; // Don't retry this function
|
||||
if (!found)
|
||||
DBUG_RETURN(0);
|
||||
for (cur_table= update_tables; cur_table ; cur_table= cur_table->next)
|
||||
{
|
||||
table = cur_table->table;
|
||||
@ -1005,6 +1031,8 @@ bool multi_update::send_eof()
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
if (local_error <= 0)
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
log_delayed);
|
||||
if (mysql_bin_log.write(&qinfo) && trans_safe)
|
||||
|
Reference in New Issue
Block a user