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

Function fix_constraints_names

sql/sql_table.cc:6776–6814  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6774
6775
6776static bool fix_constraints_names(THD *thd, List<Virtual_column_info>
6777 *check_constraint_list,
6778 const HA_CREATE_INFO *create_info)
6779{
6780 List_iterator<Virtual_column_info> it((*check_constraint_list));
6781 Virtual_column_info *check;
6782 uint nr= 1;
6783 DBUG_ENTER("fix_constraints_names");
6784 if (!check_constraint_list)
6785 DBUG_RETURN(FALSE);
6786 // Prevent accessing freed memory during generating unique names
6787 while ((check=it++))
6788 {
6789 if (check->automatic_name)
6790 {
6791 check->name.str= NULL;
6792 check->name.length= 0;
6793 }
6794 }
6795 it.rewind();
6796 // Generate unique names if needed
6797 while ((check=it++))
6798 {
6799 if (!check->name.length)
6800 {
6801 check->automatic_name= TRUE;
6802
6803 const char *own_name_base= create_info->period_info.constr == check
6804 ? create_info->period_info.name.str : NULL;
6805
6806 if (make_unique_constraint_name(thd, &check->name,
6807 own_name_base,
6808 check_constraint_list,
6809 &nr))
6810 DBUG_RETURN(TRUE);
6811 }
6812 }
6813 DBUG_RETURN(FALSE);
6814}
6815
6816
6817static int compare_uint(const void *s_, const void *t_)

Callers 2

create_table_implFunction · 0.85
mysql_alter_tableFunction · 0.85

Calls 2

rewindMethod · 0.45

Tested by

no test coverage detected