2307
2307
@param cond condition whose multiple equalities are to be checked
2308
2308
@param table constant table that has been read
2310
static void update_const_equal_items(COND *cond, JoinTable *tab)
2310
void update_const_equal_items(COND *cond, JoinTable *tab)
2312
2312
if (!(cond->used_tables() & tab->table->map))
3370
int join_read_const_table(JoinTable *tab, optimizer::Position *pos)
3373
Table *table=tab->table;
3374
table->const_table=1;
3376
table->status=STATUS_NO_RECORD;
3378
if (tab->type == AM_SYSTEM)
3380
if ((error=join_read_system(tab)))
3381
{ // Info for DESCRIBE
3382
tab->info="const row not found";
3383
/* Mark for EXPLAIN that the row was not found */
3384
pos->setFanout(0.0);
3385
pos->clearRefDependMap();
3386
if (! table->maybe_null || error > 0)
3392
if (! table->key_read &&
3393
table->covering_keys.test(tab->ref.key) &&
3394
! table->no_keyread &&
3395
(int) table->reginfo.lock_type <= (int) TL_READ_WITH_SHARED_LOCKS)
3398
table->cursor->extra(HA_EXTRA_KEYREAD);
3399
tab->index= tab->ref.key;
3401
error=join_read_const(tab);
3402
if (table->key_read)
3405
table->cursor->extra(HA_EXTRA_NO_KEYREAD);
3409
tab->info="unique row not found";
3410
/* Mark for EXPLAIN that the row was not found */
3411
pos->setFanout(0.0);
3412
pos->clearRefDependMap();
3413
if (!table->maybe_null || error > 0)
3417
if (*tab->on_expr_ref && !table->null_row)
3419
if ((table->null_row= test((*tab->on_expr_ref)->val_int() == 0)))
3420
table->mark_as_null_row();
3422
if (!table->null_row)
3423
table->maybe_null=0;
3425
/* Check appearance of new constant items in Item_equal objects */
3426
Join *join= tab->join;
3428
update_const_equal_items(join->conds, tab);
3430
for (tbl= join->select_lex->leaf_tables; tbl; tbl= tbl->next_leaf)
3432
TableList *embedded;
3433
TableList *embedding= tbl;
3436
embedded= embedding;
3437
if (embedded->on_expr)
3438
update_const_equal_items(embedded->on_expr, tab);
3439
embedding= embedded->getEmbedding();
3442
embedding->getNestedJoin()->join_list.head() == embedded);
3448
3371
int join_read_system(JoinTable *tab)