1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Fixes during review of new code

- Mostly indentation fixes
- Added missing test
- Ensure that Item_func_case() checks for stack overruns
- Use real_item() instead of (Item_ref*) item
- Fixed wrong error handling
This commit is contained in:
monty@mysql.com
2005-07-04 03:42:33 +03:00
parent e4bb8377c7
commit ec420bfb43
26 changed files with 443 additions and 313 deletions

View File

@ -58,13 +58,13 @@ static void make_unique_view_field_name(Item *target,
char *name= (target->orig_name ?
target->orig_name :
target->name);
uint name_len;
uint attempt= 0;
uint name_len, attempt;
char buff[NAME_LEN+1];
for (;; attempt++)
List_iterator_fast<Item> itc(item_list);
for (attempt= 0;; attempt++)
{
Item *check;
List_iterator_fast<Item> itc(item_list);
bool ok= TRUE;
if (attempt)
@ -84,6 +84,7 @@ static void make_unique_view_field_name(Item *target,
} while (check != last_element);
if (ok)
break;
itc.rewind();
}
target->orig_name= target->name;
@ -305,13 +306,14 @@ bool mysql_create_view(THD *thd,
{
Item *item;
List_iterator_fast<Item> it(select_lex->item_list);
List_iterator_fast<Item> itc(select_lex->item_list);
while ((item= it++))
{
Item *check;
List_iterator_fast<Item> itc(select_lex->item_list);
/* 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)
@ -822,6 +824,7 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
old_lex->can_use_merged()) &&
!old_lex->can_not_use_merged())
{
List_iterator_fast<TABLE_LIST> ti(view_select->top_join_list);
/* lex should contain at least one table */
DBUG_ASSERT(view_tables != 0);
@ -852,13 +855,11 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
nested_join->join_list= view_select->top_join_list;
/* re-nest tables of VIEW */
ti.rewind();
while ((tbl= ti++))
{
List_iterator_fast<TABLE_LIST> ti(nested_join->join_list);
while ((tbl= ti++))
{
tbl->join_list= &nested_join->join_list;
tbl->embedding= table;
}
tbl->join_list= &nested_join->join_list;
tbl->embedding= table;
}
}