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

Function calculate_interval_lengths

sql/sql_table.cc:700–715  ·  view source on GitHub ↗

Check TYPELIB (set or enum) max and total lengths SYNOPSIS calculate_interval_lengths() cs charset+collation pair of the interval typelib list of values for the column max_length length of the longest item tot_length sum of the item lengths DESCRIPTION After this function call: - ENUM uses max_length - SET uses tot_length. RETURN VALU

Source from the content-addressed store, hash-verified

698 void
699*/
700static void calculate_interval_lengths(const CHARSET_INFO *cs,
701 TYPELIB *interval,
702 uint32 *max_length,
703 uint32 *tot_length)
704{
705 const char **pos;
706 uint *len;
707 *max_length= *tot_length= 0;
708 for (pos= interval->type_names, len= interval->type_lengths;
709 *pos ; pos++, len++)
710 {
711 size_t length= cs->cset->numchars(cs, *pos, *pos + *len);
712 *tot_length+= length;
713 set_if_bigger(*max_length, (uint32)length);
714 }
715}
716
717
718

Callers 1

sp_prepare_create_fieldFunction · 0.85

Calls 1

numcharsMethod · 0.80

Tested by

no test coverage detected