@@ -152,7 +152,6 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
152
152
}
153
153
}
154
154
155
- #define ICP_COND_USES_INDEX_ONLY 10
156
155
157
156
/*
158
157
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
160
make_cond_for_index()
162
161
cond The source condition
163
162
table The table that is partially available
164
- keyno The index in the above table. Only fields covered by the index
165
- are available
163
+ keyno The index in the above table. Only fields covered by the
164
+ index are available
166
165
other_tbls_ok TRUE <=> Fields of other non-const tables are allowed
167
166
168
167
DESCRIPTION
@@ -173,8 +172,8 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
173
172
174
173
Example:
175
174
make_cond_for_index(
176
- "cond(t1.field) AND cond(t2.key1) AND cond(t2.non_key) AND cond(t2.key2)",
177
- t2, keyno(t2.key1))
175
+ "cond(t1.field) AND cond(t2.key1) AND cond(t2.non_key) AND cond(t2.key2)",
176
+ t2, keyno(t2.key1))
178
177
will return
179
178
"cond(t1.field) AND cond(t2.key2)"
180
179
@@ -189,7 +188,6 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
189
188
return cond;
190
189
if (cond->type () == Item::COND_ITEM)
191
190
{
192
- uint n_marked= 0 ;
193
191
if (((Item_cond*) cond)->functype () == Item_func::COND_AND_FUNC)
194
192
{
195
193
table_map used_tables= 0 ;
@@ -206,14 +204,7 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
206
204
new_cond->argument_list ()->push_back (fix, thd->mem_root );
207
205
used_tables|= fix->used_tables ();
208
206
}
209
- if (item->marker == ICP_COND_USES_INDEX_ONLY)
210
- {
211
- n_marked++;
212
- item->marker = 0 ;
213
- }
214
207
}
215
- if (n_marked ==((Item_cond*)cond)->argument_list ()->elements )
216
- cond->marker = ICP_COND_USES_INDEX_ONLY;
217
208
switch (new_cond->argument_list ()->elements ) {
218
209
case 0 :
219
210
return (COND*) 0 ;
@@ -239,14 +230,7 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
239
230
if (!fix)
240
231
return (COND*) 0 ;
241
232
new_cond->argument_list ()->push_back (fix, thd->mem_root );
242
- if (item->marker == ICP_COND_USES_INDEX_ONLY)
243
- {
244
- n_marked++;
245
- item->marker = 0 ;
246
- }
247
233
}
248
- if (n_marked ==((Item_cond*)cond)->argument_list ()->elements )
249
- cond->marker = ICP_COND_USES_INDEX_ONLY;
250
234
new_cond->quick_fix_field ();
251
235
new_cond->used_tables_cache = ((Item_cond_or*) cond)->used_tables_cache ;
252
236
new_cond->top_level_item ();
@@ -256,7 +240,6 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
256
240
257
241
if (!uses_index_fields_only (cond, table, keyno, other_tbls_ok))
258
242
return (COND*) 0 ;
259
- cond->marker = ICP_COND_USES_INDEX_ONLY;
260
243
return cond;
261
244
}
262
245
0 commit comments