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

Function tablename_to_filename

sql/sql_table.cc:458–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456*/
457
458uint tablename_to_filename(const char *from, char *to, uint to_length)
459{
460 uint errors, length;
461 DBUG_ENTER("tablename_to_filename");
462 DBUG_PRINT("enter", ("from '%s'", from));
463
464 if ((length= check_n_cut_mysql50_prefix(from, to, to_length)))
465 {
466 /*
467 Check if the name supplied is a valid mysql 5.0 name and
468 make the name a zero length string if it's not.
469 Note that just returning zero length is not enough :
470 a lot of places don't check the return value and expect
471 a zero terminated string.
472 */
473 if (check_table_name(to, length, TRUE) != IDENT_NAME_OK)
474 {
475 to[0]= 0;
476 length= 0;
477 }
478 DBUG_RETURN(length);
479 }
480 length= strconvert(system_charset_info, from,
481 &my_charset_filename, to, to_length, &errors);
482 if (check_if_legal_tablename(to) &&
483 length + 4 < to_length)
484 {
485 memcpy(to + length, "@@@", 4);
486 length+= 3;
487 }
488 DBUG_PRINT("exit", ("to '%s'", to));
489 DBUG_RETURN(length);
490}
491
492
493/*

Callers 1

build_table_filenameFunction · 0.85

Calls 4

check_table_nameFunction · 0.85
strconvertFunction · 0.85
check_if_legal_tablenameFunction · 0.85

Tested by

no test coverage detected