Commit 0c7b0189 authored by Monty's avatar Monty Committed by Sergei Golubchik

Remove not used IPC_COND_USED_INDEX

parent acf282c3
...@@ -152,7 +152,6 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno, ...@@ -152,7 +152,6 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
} }
} }
#define ICP_COND_USES_INDEX_ONLY 10
/* /*
Get a part of the condition that can be checked using only index fields Get a part of the condition that can be checked using only index fields
...@@ -161,8 +160,8 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno, ...@@ -161,8 +160,8 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
make_cond_for_index() make_cond_for_index()
cond The source condition cond The source condition
table The table that is partially available table The table that is partially available
keyno The index in the above table. Only fields covered by the index keyno The index in the above table. Only fields covered by the
are available index are available
other_tbls_ok TRUE <=> Fields of other non-const tables are allowed other_tbls_ok TRUE <=> Fields of other non-const tables are allowed
DESCRIPTION DESCRIPTION
...@@ -173,8 +172,8 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno, ...@@ -173,8 +172,8 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
Example: Example:
make_cond_for_index( make_cond_for_index(
"cond(t1.field) AND cond(t2.key1) AND cond(t2.non_key) AND cond(t2.key2)", "cond(t1.field) AND cond(t2.key1) AND cond(t2.non_key) AND cond(t2.key2)",
t2, keyno(t2.key1)) t2, keyno(t2.key1))
will return will return
"cond(t1.field) AND cond(t2.key2)" "cond(t1.field) AND cond(t2.key2)"
...@@ -189,7 +188,6 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno, ...@@ -189,7 +188,6 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
return cond; return cond;
if (cond->type() == Item::COND_ITEM) if (cond->type() == Item::COND_ITEM)
{ {
uint n_marked= 0;
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC) if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
{ {
table_map used_tables= 0; table_map used_tables= 0;
...@@ -206,14 +204,7 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno, ...@@ -206,14 +204,7 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
new_cond->argument_list()->push_back(fix, thd->mem_root); new_cond->argument_list()->push_back(fix, thd->mem_root);
used_tables|= fix->used_tables(); used_tables|= fix->used_tables();
} }
if (item->marker == ICP_COND_USES_INDEX_ONLY)
{
n_marked++;
item->marker= 0;
}
} }
if (n_marked ==((Item_cond*)cond)->argument_list()->elements)
cond->marker= ICP_COND_USES_INDEX_ONLY;
switch (new_cond->argument_list()->elements) { switch (new_cond->argument_list()->elements) {
case 0: case 0:
return (COND*) 0; return (COND*) 0;
...@@ -239,14 +230,7 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno, ...@@ -239,14 +230,7 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
if (!fix) if (!fix)
return (COND*) 0; return (COND*) 0;
new_cond->argument_list()->push_back(fix, thd->mem_root); new_cond->argument_list()->push_back(fix, thd->mem_root);
if (item->marker == ICP_COND_USES_INDEX_ONLY)
{
n_marked++;
item->marker= 0;
}
} }
if (n_marked ==((Item_cond*)cond)->argument_list()->elements)
cond->marker= ICP_COND_USES_INDEX_ONLY;
new_cond->quick_fix_field(); new_cond->quick_fix_field();
new_cond->used_tables_cache= ((Item_cond_or*) cond)->used_tables_cache; new_cond->used_tables_cache= ((Item_cond_or*) cond)->used_tables_cache;
new_cond->top_level_item(); new_cond->top_level_item();
...@@ -256,7 +240,6 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno, ...@@ -256,7 +240,6 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
if (!uses_index_fields_only(cond, table, keyno, other_tbls_ok)) if (!uses_index_fields_only(cond, table, keyno, other_tbls_ok))
return (COND*) 0; return (COND*) 0;
cond->marker= ICP_COND_USES_INDEX_ONLY;
return cond; return cond;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment