MCPcopy Create free account
hub / github.com/MariaDB/server / check_duplicate_names

Function check_duplicate_names

sql/sql_view.cc:130–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128*/
129
130bool check_duplicate_names(THD *thd, List<Item> &item_list, bool gen_unique_view_name)
131{
132 Item *item;
133 List_iterator_fast<Item> it(item_list);
134 List_iterator_fast<Item> itc(item_list);
135 DBUG_ENTER("check_duplicate_names");
136
137 while ((item= it++))
138 {
139 Item *check;
140 /* treat underlying fields like set by user names */
141 if (item->real_item()->type() == Item::FIELD_ITEM)
142 item->base_flags|= item_base_t::IS_EXPLICIT_NAME;
143 itc.rewind();
144 while ((check= itc++) && check != item)
145 {
146 if (item->name.streq(check->name))
147 {
148 if (!gen_unique_view_name)
149 goto err;
150 if (!item->is_explicit_name())
151 make_unique_view_field_name(thd, item, item_list, item);
152 else if (!check->is_explicit_name())
153 make_unique_view_field_name(thd, check, item_list, item);
154 else
155 goto err;
156 }
157 }
158 }
159 DBUG_RETURN(FALSE);
160
161err:
162 my_error(ER_DUP_FIELDNAME, MYF(0), item->name.str);
163 DBUG_RETURN(TRUE);
164}
165
166
167/**

Callers 4

prepare_unreferencedMethod · 0.85
mysql_derived_prepareFunction · 0.85
mysql_create_viewFunction · 0.85
prepareMethod · 0.85

Calls 7

my_errorFunction · 0.85
is_explicit_nameMethod · 0.80
typeMethod · 0.45
real_itemMethod · 0.45
rewindMethod · 0.45
streqMethod · 0.45

Tested by

no test coverage detected