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

Function check_and_convert_db_name

sql/table.cc:524–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522*/
523
524enum_ident_name_check check_and_convert_db_name(LEX_STRING *org_name,
525 bool preserve_lettercase)
526{
527 char *name= org_name->str;
528 uint name_length= org_name->length;
529 bool check_for_path_chars;
530 enum_ident_name_check ident_check_status;
531
532 if (!name_length || name_length > NAME_LEN)
533 {
534 my_error(ER_WRONG_DB_NAME, MYF(0), org_name->str);
535 return IDENT_NAME_WRONG;
536 }
537
538 if ((check_for_path_chars= check_mysql50_prefix(name)))
539 {
540 name+= MYSQL50_TABLE_NAME_PREFIX_LENGTH;
541 name_length-= MYSQL50_TABLE_NAME_PREFIX_LENGTH;
542 }
543
544 if (!preserve_lettercase && lower_case_table_names && name != any_db)
545 my_casedn_str(files_charset_info, name);
546
547 ident_check_status= check_table_name(name, name_length, check_for_path_chars);
548 if (ident_check_status == IDENT_NAME_WRONG)
549 my_error(ER_WRONG_DB_NAME, MYF(0), org_name->str);
550 else if (ident_check_status == IDENT_NAME_TOO_LONG)
551 my_error(ER_TOO_LONG_IDENT, MYF(0), org_name->str);
552 return ident_check_status;
553}
554
555
556/**

Callers 1

add_table_to_listMethod · 0.85

Calls 3

my_errorFunction · 0.85
check_mysql50_prefixFunction · 0.85
check_table_nameFunction · 0.85

Tested by

no test coverage detected