summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-05-27 14:14:27 +0400
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-05-27 14:14:27 +0400
commit4c31276e6642c1e4c200da030d77746a5a386ff2 (patch)
treee6f7855de4def00b28e634185552006b499a7f50 /sql
parentf0df2886c10c720c8d734509e9523716d42330ef (diff)
parent1d0acc7754a44613d2ad56dc2231f20a1bedf718 (diff)
downloadmariadb-git-4c31276e6642c1e4c200da030d77746a5a386ff2.tar.gz
Automerge.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_update.cc2
-rw-r--r--sql/table.cc21
-rw-r--r--sql/table.h1
3 files changed, 23 insertions, 1 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 69f3a29e923..7df0898e841 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -397,7 +397,7 @@ int mysql_update(THD *thd,
matching rows before updating the table!
*/
if (used_index < MAX_KEY && old_covering_keys.is_set(used_index))
- table->mark_columns_used_by_index(used_index);
+ table->add_read_columns_used_by_index(used_index);
else
{
table->use_all_columns();
diff --git a/sql/table.cc b/sql/table.cc
index 8b97dd36170..0fef7fa639a 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -4378,6 +4378,27 @@ void st_table::mark_columns_used_by_index(uint index)
/*
+ Add fields used by a specified index to the table's read_set.
+
+ NOTE:
+ The original state can be restored with
+ restore_column_maps_after_mark_index().
+*/
+
+void st_table::add_read_columns_used_by_index(uint index)
+{
+ MY_BITMAP *bitmap= &tmp_set;
+ DBUG_ENTER("st_table::add_read_columns_used_by_index");
+
+ set_keyread(TRUE);
+ bitmap_copy(bitmap, read_set);
+ mark_columns_used_by_index_no_reset(index, bitmap);
+ column_bitmaps_set(bitmap, write_set);
+ DBUG_VOID_RETURN;
+}
+
+
+/*
Restore to use normal column maps after key read
NOTES
diff --git a/sql/table.h b/sql/table.h
index bddb0731625..4125c252427 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -865,6 +865,7 @@ struct st_table {
void prepare_for_position(void);
void mark_columns_used_by_index_no_reset(uint index, MY_BITMAP *map);
void mark_columns_used_by_index(uint index);
+ void add_read_columns_used_by_index(uint index);
void restore_column_maps_after_mark_index();
void mark_auto_increment_column(void);
void mark_columns_needed_for_update(void);