MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / check_duplicates_in_interval

Function check_duplicates_in_interval

sql/sql_table.cc:647–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645*/
646
647bool check_duplicates_in_interval(const char *set_or_name,
648 const char *name, TYPELIB *typelib,
649 const CHARSET_INFO *cs, uint *dup_val_count)
650{
651 TYPELIB tmp= *typelib;
652 const char **cur_value= typelib->type_names;
653 unsigned int *cur_length= typelib->type_lengths;
654 *dup_val_count= 0;
655
656 for ( ; tmp.count > 1; cur_value++, cur_length++)
657 {
658 tmp.type_names++;
659 tmp.type_lengths++;
660 tmp.count--;
661 if (find_type2(&tmp, (const char*)*cur_value, *cur_length, cs))
662 {
663 THD *thd= current_thd;
664 ErrConvString err(*cur_value, *cur_length, cs);
665 if (current_thd->is_strict_mode())
666 {
667 my_error(ER_DUPLICATED_VALUE_IN_TYPE, MYF(0),
668 name, err.ptr(), set_or_name);
669 return 1;
670 }
671 push_warning_printf(thd,Sql_condition::WARN_LEVEL_NOTE,
672 ER_DUPLICATED_VALUE_IN_TYPE,
673 ER(ER_DUPLICATED_VALUE_IN_TYPE),
674 name, err.ptr(), set_or_name);
675 (*dup_val_count)++;
676 }
677 }
678 return 0;
679}
680
681
682/*

Callers 1

prepare_create_fieldFunction · 0.85

Calls 5

find_type2Function · 0.85
my_errorFunction · 0.85
push_warning_printfFunction · 0.85
is_strict_modeMethod · 0.80
ptrMethod · 0.45

Tested by

no test coverage detected