diff options
author | unknown <monty@mysql.com> | 2005-08-18 03:12:42 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-08-18 03:12:42 +0300 |
commit | 44086a625ba427522c7984f71a94f61d22122f3b (patch) | |
tree | 539169e9b0ec85fd466c859729fb9630778435b8 /sql/sql_view.cc | |
parent | 219c84faba28171cc04608f826703f5c031d70bc (diff) | |
download | mariadb-git-44086a625ba427522c7984f71a94f61d22122f3b.tar.gz |
Cleanups and optimization during review of new code
mysql-test/t/kill.test:
Moved --disable_reconnect earlier to avoid race condition
sql/sql_help.cc:
Cleanup during review of new code
(Moved variable definitions first in function
sql/sql_insert.cc:
Cleanup during review of new code
sql/sql_lex.cc:
Cleanup during review of new code
sql/sql_parse.cc:
Cleanup during review of new code
Changed potential problem with previous_table_ref where it dependent that TABLE_LIST first element would be next_local
Rearanged code in add_table_to_list() to remove extra if
Combined 2 calls to calloc() to one
sql/sql_view.cc:
Remove extra indentation level
Combined common 'on error' exit
sql/sql_yacc.yy:
Fixed comment style
sql/table.cc:
Cleanup during review of new code
- Changed while() loops to for() loop (to make code more readable)
- Removed not needed initialization of variables
- Removed not needed 'else' cases
- Removed trivial ASSERT's that was checked by previous code
- Moved comment setting last in Natural_join_column::check_grants()
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r-- | sql/sql_view.cc | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc index c3222f951bb..577d1d32fcc 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -120,42 +120,38 @@ static void make_unique_view_field_name(Item *target, bool check_duplicate_names(List<Item> &item_list, bool gen_unique_view_name) { + Item *item; + List_iterator_fast<Item> it(item_list); + List_iterator_fast<Item> itc(item_list); DBUG_ENTER("check_duplicate_names"); - /* Test absence of duplicates names */ + + while ((item= it++)) { - Item *item; - List_iterator_fast<Item> it(item_list); - List_iterator_fast<Item> itc(item_list); - while ((item= it++)) + Item *check; + /* treat underlying fields like set by user names */ + if (item->real_item()->type() == Item::FIELD_ITEM) + item->is_autogenerated_name= FALSE; + itc.rewind(); + while ((check= itc++) && check != item) { - Item *check; - /* treat underlying fields like set by user names */ - if (item->real_item()->type() == Item::FIELD_ITEM) - item->is_autogenerated_name= FALSE; - itc.rewind(); - while ((check= itc++) && check != item) + if (my_strcasecmp(system_charset_info, item->name, check->name) == 0) { - if (my_strcasecmp(system_charset_info, item->name, check->name) == 0) - { - if (!gen_unique_view_name) - { - my_error(ER_DUP_FIELDNAME, MYF(0), item->name); - DBUG_RETURN(TRUE); - } - else if (item->is_autogenerated_name) - make_unique_view_field_name(item, item_list, item); - else if (check->is_autogenerated_name) - make_unique_view_field_name(check, item_list, item); - else - { - my_error(ER_DUP_FIELDNAME, MYF(0), item->name); - DBUG_RETURN(TRUE); - } - } + if (!gen_unique_view_name) + goto err; + if (item->is_autogenerated_name) + make_unique_view_field_name(item, item_list, item); + else if (check->is_autogenerated_name) + make_unique_view_field_name(check, item_list, item); + else + goto err; } } } DBUG_RETURN(FALSE); + +err: + my_error(ER_DUP_FIELDNAME, MYF(0), item->name); + DBUG_RETURN(TRUE); } |