summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-07-04 03:42:33 +0300
committerunknown <monty@mysql.com>2005-07-04 03:42:33 +0300
commit306ebf7b1c1b26b45e93fbcbbf248b3479142c41 (patch)
tree502bf1c54d87aaf8e4cafea943108c20d146cacc /sql/sql_view.cc
parent1aa6343fe8d9a1d61aa7fcd4246fb5858b3dfa16 (diff)
downloadmariadb-git-306ebf7b1c1b26b45e93fbcbbf248b3479142c41.tar.gz
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 myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 0b351407c13..25610f8749b 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -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;
}
}