mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
merge
This commit is contained in:
@ -6487,6 +6487,56 @@ void rr_unlock_row(st_join_table *tab)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Pick the appropriate access method functions
|
||||
|
||||
Sets the functions for the selected table access method
|
||||
|
||||
@param tab Table reference to put access method
|
||||
*/
|
||||
|
||||
static void
|
||||
pick_table_access_method(JOIN_TAB *tab)
|
||||
{
|
||||
switch (tab->type)
|
||||
{
|
||||
case JT_REF:
|
||||
tab->read_first_record= join_read_always_key;
|
||||
tab->read_record.read_record= join_read_next_same;
|
||||
break;
|
||||
|
||||
case JT_REF_OR_NULL:
|
||||
tab->read_first_record= join_read_always_key_or_null;
|
||||
tab->read_record.read_record= join_read_next_same_or_null;
|
||||
break;
|
||||
|
||||
case JT_CONST:
|
||||
tab->read_first_record= join_read_const;
|
||||
tab->read_record.read_record= join_no_more_records;
|
||||
break;
|
||||
|
||||
case JT_EQ_REF:
|
||||
tab->read_first_record= join_read_key;
|
||||
tab->read_record.read_record= join_no_more_records;
|
||||
break;
|
||||
|
||||
case JT_FT:
|
||||
tab->read_first_record= join_ft_read_first;
|
||||
tab->read_record.read_record= join_ft_read_next;
|
||||
break;
|
||||
|
||||
case JT_SYSTEM:
|
||||
tab->read_first_record= join_read_system;
|
||||
tab->read_record.read_record= join_no_more_records;
|
||||
break;
|
||||
|
||||
/* keep gcc happy */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
make_join_readinfo(JOIN *join, ulonglong options)
|
||||
{
|
||||
@ -6521,45 +6571,15 @@ make_join_readinfo(JOIN *join, ulonglong options)
|
||||
|
||||
tab->sorted= sorted;
|
||||
sorted= 0; // only first must be sorted
|
||||
table->status=STATUS_NO_RECORD;
|
||||
pick_table_access_method (tab);
|
||||
|
||||
switch (tab->type) {
|
||||
case JT_SYSTEM: // Only happens with left join
|
||||
table->status=STATUS_NO_RECORD;
|
||||
tab->read_first_record= join_read_system;
|
||||
tab->read_record.read_record= join_no_more_records;
|
||||
break;
|
||||
case JT_CONST: // Only happens with left join
|
||||
table->status=STATUS_NO_RECORD;
|
||||
tab->read_first_record= join_read_const;
|
||||
tab->read_record.read_record= join_no_more_records;
|
||||
if (table->covering_keys.is_set(tab->ref.key) &&
|
||||
!table->no_keyread)
|
||||
{
|
||||
table->key_read=1;
|
||||
table->file->extra(HA_EXTRA_KEYREAD);
|
||||
}
|
||||
break;
|
||||
case JT_EQ_REF:
|
||||
table->status=STATUS_NO_RECORD;
|
||||
if (tab->select)
|
||||
{
|
||||
delete tab->select->quick;
|
||||
tab->select->quick=0;
|
||||
}
|
||||
delete tab->quick;
|
||||
tab->quick=0;
|
||||
tab->read_first_record= join_read_key;
|
||||
tab->read_record.unlock_row= join_read_key_unlock_row;
|
||||
tab->read_record.read_record= join_no_more_records;
|
||||
if (table->covering_keys.is_set(tab->ref.key) &&
|
||||
!table->no_keyread)
|
||||
{
|
||||
table->key_read=1;
|
||||
table->file->extra(HA_EXTRA_KEYREAD);
|
||||
}
|
||||
break;
|
||||
/* fall through */
|
||||
case JT_REF_OR_NULL:
|
||||
case JT_REF:
|
||||
table->status=STATUS_NO_RECORD;
|
||||
if (tab->select)
|
||||
{
|
||||
delete tab->select->quick;
|
||||
@ -6567,34 +6587,20 @@ make_join_readinfo(JOIN *join, ulonglong options)
|
||||
}
|
||||
delete tab->quick;
|
||||
tab->quick=0;
|
||||
/* fall through */
|
||||
case JT_CONST: // Only happens with left join
|
||||
if (table->covering_keys.is_set(tab->ref.key) &&
|
||||
!table->no_keyread)
|
||||
{
|
||||
table->key_read=1;
|
||||
table->file->extra(HA_EXTRA_KEYREAD);
|
||||
}
|
||||
if (tab->type == JT_REF)
|
||||
{
|
||||
tab->read_first_record= join_read_always_key;
|
||||
tab->read_record.read_record= join_read_next_same;
|
||||
}
|
||||
else
|
||||
{
|
||||
tab->read_first_record= join_read_always_key_or_null;
|
||||
tab->read_record.read_record= join_read_next_same_or_null;
|
||||
}
|
||||
break;
|
||||
case JT_FT:
|
||||
table->status=STATUS_NO_RECORD;
|
||||
tab->read_first_record= join_ft_read_first;
|
||||
tab->read_record.read_record= join_ft_read_next;
|
||||
break;
|
||||
case JT_ALL:
|
||||
/*
|
||||
If previous table use cache
|
||||
If the incoming data set is already sorted don't use cache.
|
||||
*/
|
||||
table->status=STATUS_NO_RECORD;
|
||||
if (i != join->const_tables && !(options & SELECT_NO_JOIN_CACHE) &&
|
||||
tab->use_quick != 2 && !tab->first_inner && !ordered_set)
|
||||
{
|
||||
@ -6674,6 +6680,9 @@ make_join_readinfo(JOIN *join, ulonglong options)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case JT_FT:
|
||||
case JT_SYSTEM:
|
||||
break;
|
||||
default:
|
||||
DBUG_PRINT("error",("Table type %d found",tab->type)); /* purecov: deadcode */
|
||||
break; /* purecov: deadcode */
|
||||
@ -13195,6 +13204,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
||||
if (create_ref_for_key(tab->join, tab, keyuse,
|
||||
tab->join->const_table_map))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
pick_table_access_method(tab);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user