diff options
author | unknown <psergey@psergey.(none)> | 2003-11-13 22:14:37 +0300 |
---|---|---|
committer | unknown <psergey@psergey.(none)> | 2003-11-13 22:14:37 +0300 |
commit | 738728bd1144a29a9b8b380c6a129afc3acdcfc4 (patch) | |
tree | ee449f3b5dcb528030efbeea367fa2b4c2183c94 /sql/sql_update.cc | |
parent | 4696bb41b4cce563ffff8d7b6c32576214109113 (diff) | |
parent | 6e464cc06d8340cb5f0f26fd6894301eef55af1f (diff) | |
download | mariadb-git-738728bd1144a29a9b8b380c6a129afc3acdcfc4.tar.gz |
merging in index_merge (in progress, not yet working)
BitKeeper/etc/logging_ok:
auto-union
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r-- | sql/sql_update.cc | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 8c400b2e98e..4ea14fcc68f 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -177,10 +177,18 @@ int mysql_update(THD *thd, init_ftfuncs(thd, &thd->lex->select_lex, 1); /* Check if we are modifying a key that we are used to search with */ if (select && select->quick) - used_key_is_modified= (!select->quick->unique_key_range() && - check_if_key_used(table, - (used_index=select->quick->index), - fields)); + { + if (select->quick->get_type() != QUICK_SELECT_I::QS_TYPE_INDEX_MERGE) + { + used_index= select->quick->index; + used_key_is_modified= (!select->quick->unique_key_range() && + check_if_key_used(table,used_index,fields)); + } + else + { + used_key_is_modified= true; + } + } else if ((used_index=table->file->key_used_on_scan) < MAX_KEY) used_key_is_modified=check_if_key_used(table, used_index, fields); else @@ -699,8 +707,26 @@ static bool safe_update_on_fly(JOIN_TAB *join_tab, List<Item> *fields) case JT_ALL: /* If range search on index */ if (join_tab->quick) - return !check_if_key_used(table, join_tab->quick->index, - *fields); + { + if (join_tab->quick->get_type() != QUICK_SELECT_I::QS_TYPE_INDEX_MERGE) + { + return !check_if_key_used(table,join_tab->quick->index,*fields); + } + else + { + QUICK_INDEX_MERGE_SELECT *qsel_imerge= + (QUICK_INDEX_MERGE_SELECT*)(join_tab->quick); + List_iterator_fast<QUICK_RANGE_SELECT> it(qsel_imerge->quick_selects); + QUICK_RANGE_SELECT *quick; + while ((quick= it++)) + { + if (check_if_key_used(table, quick->index, *fields)) + return 0; + } + return 1; + } + } + /* If scanning in clustered key */ if ((table->file->table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) && table->primary_key < MAX_KEY) |