summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/opt_range.cc13
-rw-r--r--sql/sql_select.cc4
-rw-r--r--sql/table.cc25
-rw-r--r--storage/xtradb/handler/ha_innodb.cc4
4 files changed, 29 insertions, 17 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 200c3efaa98..80034a21141 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2987,7 +2987,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0);
if (!(param.key_parts=
(KEY_PART*) alloc_root(&alloc,
- sizeof(KEY_PART)*
+ sizeof(KEY_PART) *
head->s->actual_n_key_parts(thd))) ||
fill_used_fields_bitmap(&param))
{
@@ -11717,7 +11717,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
if (!table->covering_keys.is_set(cur_index))
goto next_index;
- /*
+ /*
Unless extended keys can be used for cur_index:
If the current storage manager is such that it appends the primary key to
each index, then the above condition is insufficient to check if the
@@ -11727,8 +11727,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
does not qualify as covering in our case. If this is the case, below
we check that all query fields are indeed covered by 'cur_index'.
*/
- if (cur_index_info->key_parts==table->actual_n_key_parts(cur_index_info) &&
- pk < MAX_KEY && cur_index != pk &&
+ if (cur_index_info->key_parts == table->actual_n_key_parts(cur_index_info)
+ && pk < MAX_KEY && cur_index != pk &&
(table->file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX))
{
/* For each table field */
@@ -11845,7 +11845,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
If there is no MIN/MAX, the keyparts after the last group part can be
referenced only in equalities with constants, and the referenced keyparts
must form a sequence without any gaps that starts immediately after the
- last group keyparyt.
+ last group keypart.
*/
key_parts= table->actual_n_key_parts(cur_index_info);
last_part= cur_index_info->key_part + key_parts;
@@ -12299,7 +12299,8 @@ get_field_keypart(KEY *index, Field *field)
{
KEY_PART_INFO *part, *end;
- for (part= index->key_part, end= part+field->table->actual_n_key_parts(index);
+ for (part= index->key_part,
+ end= part + field->table->actual_n_key_parts(index);
part < end; part++)
{
if (field->eq(part->field))
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c5049e9df31..c8ae2f7278a 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3406,7 +3406,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
The effect of this is that we don't do const substitution for
such tables.
*/
- KEY *keyinfo= table->key_info+key;
+ KEY *keyinfo= table->key_info + key;
uint key_parts= table->actual_n_key_parts(keyinfo);
if (eq_part.is_prefix(key_parts) &&
!table->fulltext_searched &&
@@ -4746,7 +4746,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
/* fill keyuse with found key parts */
for ( ; field != end ; field++)
{
- if (add_key_part(keyuse, field))
+ if (add_key_part(keyuse,field))
return TRUE;
}
diff --git a/sql/table.cc b/sql/table.cc
index 54f99cff28b..631c61f8391 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -809,6 +809,11 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->keys_for_keyread.init(0);
share->keys_in_use.init(keys);
+ /*
+ At this point we don't have enough information read from the frm file
+ to get a proper handlerton for the interesting engine in order to get
+ properties of this engine.
+ */
/* Currently only InnoDB can use extended keys */
share->set_use_ext_keys_flag(legacy_db_type == DB_TYPE_INNODB);
@@ -830,6 +835,10 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
added that are not included in the proper key definition.
If after all it turns out that there is no primary key the
added components are removed from each key.
+
+ When in the future we support others schemes of extending of
+ secondary keys with components of the primary key we'll have
+ to change the type of this flag for an enumeration type.
*/
for (i=0 ; i < keys ; i++, keyinfo++)
@@ -857,16 +866,16 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
ext_key_parts= key_parts +
(share->use_ext_keys ? first_keyinfo.key_parts*(keys-1) : 0);
- n_length=keys*sizeof(KEY)+ext_key_parts*sizeof(KEY_PART_INFO);
+ n_length=keys * sizeof(KEY) + ext_key_parts * sizeof(KEY_PART_INFO);
if (!(keyinfo= (KEY*) alloc_root(&share->mem_root,
n_length + len)))
goto err; /* purecov: inspected */
bzero((char*) keyinfo,n_length);
share->key_info= keyinfo;
- key_part= my_reinterpret_cast(KEY_PART_INFO*) (keyinfo+keys);
+ key_part= my_reinterpret_cast(KEY_PART_INFO*) (keyinfo + keys);
if (!(rec_per_key= (ulong*) alloc_root(&share->mem_root,
- sizeof(ulong)*ext_key_parts)))
+ sizeof(ulong) * ext_key_parts)))
goto err;
first_key_part= key_part;
first_key_parts= first_keyinfo.key_parts;
@@ -913,7 +922,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
keyinfo->ext_key_flags= keyinfo->flags | HA_NOSAME;
keyinfo->ext_key_part_map= 0;
- for (j= 0; j<first_key_parts && keyinfo->ext_key_parts<MAX_REF_PARTS; j++)
+ for (j= 0;
+ j < first_key_parts && keyinfo->ext_key_parts < MAX_REF_PARTS;
+ j++)
{
uint key_parts= keyinfo->key_parts;
KEY_PART_INFO* curr_key_part= keyinfo->key_part;
@@ -1547,7 +1558,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (ext_key_parts > share->key_parts && key)
{
- KEY_PART_INFO *new_key_part= (keyinfo-1)->key_part+
+ KEY_PART_INFO *new_key_part= (keyinfo-1)->key_part +
(keyinfo-1)->ext_key_parts;
/*
@@ -2370,7 +2381,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
key_info->key_parts) ;
for ( ; key_part < key_part_end; key_part++)
{
- Field *field= key_part->field= outparam->field[key_part->fieldnr-1];
+ Field *field= key_part->field= outparam->field[key_part->fieldnr - 1];
if (field->key_length() != key_part->length &&
!(field->flags & BLOB_FLAG))
@@ -2385,7 +2396,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
}
}
if (!share->use_ext_keys)
- key_part+= key_info->ext_key_parts-key_info->key_parts;
+ key_part+= key_info->ext_key_parts - key_info->key_parts;
}
}
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 2bf3550b3da..c463f5192f3 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -8080,10 +8080,10 @@ ha_innobase::records_in_range(
heap = mem_heap_create(2 * (key_parts * sizeof(dfield_t)
+ sizeof(dtuple_t)));
- range_start = dtuple_create(heap, key_parts);
+ range_start= dtuple_create(heap, key_parts);
dict_index_copy_types(range_start, index, key_parts);
- range_end = dtuple_create(heap, key_parts);
+ range_end= dtuple_create(heap, key_parts);
dict_index_copy_types(range_end, index, key_parts);
row_sel_convert_mysql_key_to_innobase(