Commit f894f902 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: TABLE::find_field_by_name

use name hash, just like find_field_in_table() does
parent 711f3dd7
...@@ -8938,12 +8938,21 @@ void vers_select_conds_t::resolve_units(bool timestamps_only) ...@@ -8938,12 +8938,21 @@ void vers_select_conds_t::resolve_units(bool timestamps_only)
Field *TABLE::find_field_by_name(LEX_CSTRING *str) const Field *TABLE::find_field_by_name(LEX_CSTRING *str) const
{ {
Field **tmp;
size_t length= str->length; size_t length= str->length;
for (Field **tmp= field; *tmp; tmp++) if (s->name_hash.records)
{ {
if ((*tmp)->field_name.length == length && tmp= (Field**) my_hash_search(&s->name_hash, (uchar*) str->str, length);
!lex_string_cmp(system_charset_info, &(*tmp)->field_name, str)) return tmp ? field[tmp - s->field] : NULL;
return *tmp; }
else
{
for (tmp= field; *tmp; tmp++)
{
if ((*tmp)->field_name.length == length &&
!lex_string_cmp(system_charset_info, &(*tmp)->field_name, str))
return *tmp;
}
} }
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment