mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Simple cleanups
This commit is contained in:
@ -1771,41 +1771,37 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
|
||||
uint tables, COND *cond, table_map normal_tables)
|
||||
{
|
||||
uint and_level,i,found_eq_constant;
|
||||
KEY_FIELD *key_fields, *end, *field;
|
||||
|
||||
if (!(key_fields=(KEY_FIELD*)
|
||||
thd->alloc(sizeof(key_fields[0])*(thd->cond_count+1)*2)))
|
||||
return TRUE; /* purecov: inspected */
|
||||
and_level=0; field=end=key_fields;
|
||||
if (my_init_dynamic_array(keyuse,sizeof(KEYUSE),20,64))
|
||||
return TRUE;
|
||||
if (cond)
|
||||
{
|
||||
KEY_FIELD *key_fields,*end;
|
||||
KEY_FIELD *field;
|
||||
|
||||
if (!(key_fields=(KEY_FIELD*)
|
||||
thd->alloc(sizeof(key_fields[0])*(thd->cond_count+1)*2)))
|
||||
return TRUE; /* purecov: inspected */
|
||||
and_level=0; field=end=key_fields;
|
||||
if (my_init_dynamic_array(keyuse,sizeof(KEYUSE),20,64))
|
||||
return TRUE;
|
||||
if (cond)
|
||||
{
|
||||
add_key_fields(join_tab,&end,&and_level,cond,normal_tables);
|
||||
for (; field != end ; field++)
|
||||
{
|
||||
add_key_part(keyuse,field);
|
||||
/* Mark that we can optimize LEFT JOIN */
|
||||
if (field->val->type() == Item::NULL_ITEM &&
|
||||
!field->field->real_maybe_null())
|
||||
field->field->table->reginfo.not_exists_optimize=1;
|
||||
}
|
||||
}
|
||||
for (i=0 ; i < tables ; i++)
|
||||
{
|
||||
if (join_tab[i].on_expr)
|
||||
{
|
||||
add_key_fields(join_tab,&end,&and_level,join_tab[i].on_expr,
|
||||
join_tab[i].table->map);
|
||||
}
|
||||
}
|
||||
/* fill keyuse with found key parts */
|
||||
add_key_fields(join_tab,&end,&and_level,cond,normal_tables);
|
||||
for (; field != end ; field++)
|
||||
{
|
||||
add_key_part(keyuse,field);
|
||||
/* Mark that we can optimize LEFT JOIN */
|
||||
if (field->val->type() == Item::NULL_ITEM &&
|
||||
!field->field->real_maybe_null())
|
||||
field->field->table->reginfo.not_exists_optimize=1;
|
||||
}
|
||||
}
|
||||
for (i=0 ; i < tables ; i++)
|
||||
{
|
||||
if (join_tab[i].on_expr)
|
||||
{
|
||||
add_key_fields(join_tab,&end,&and_level,join_tab[i].on_expr,
|
||||
join_tab[i].table->map);
|
||||
}
|
||||
}
|
||||
/* fill keyuse with found key parts */
|
||||
for (; field != end ; field++)
|
||||
add_key_part(keyuse,field);
|
||||
|
||||
if (thd->lex.select->ftfunc_list.elements)
|
||||
{
|
||||
|
Reference in New Issue
Block a user