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

Function append_file_to_dir

sql/sql_parse.cc:1919–1941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1917/** If pointer is not a null pointer, append filename to it. */
1918
1919bool append_file_to_dir(THD *thd, const char **filename_ptr,
1920 const char *table_name)
1921{
1922 char buff[FN_REFLEN],*ptr, *end;
1923 if (!*filename_ptr)
1924 return 0; // nothing to do
1925
1926 /* Check that the filename is not too long and it's a hard path */
1927 if (strlen(*filename_ptr)+strlen(table_name) >= FN_REFLEN-1 ||
1928 !test_if_hard_path(*filename_ptr))
1929 {
1930 my_error(ER_WRONG_TABLE_NAME, MYF(0), *filename_ptr);
1931 return 1;
1932 }
1933 /* Fix is using unix filename format on dos */
1934 strmov(buff,*filename_ptr);
1935 end=convert_dirname(buff, *filename_ptr, NullS);
1936 if (!(ptr= (char*) thd->alloc((size_t) (end-buff) + strlen(table_name)+1)))
1937 return 1; // End of memory
1938 *filename_ptr=ptr;
1939 strxmov(ptr,buff,table_name,NullS);
1940 return 0;
1941}
1942
1943
1944/**

Callers

nothing calls this directly

Calls 6

test_if_hard_pathFunction · 0.85
my_errorFunction · 0.85
strmovFunction · 0.85
convert_dirnameFunction · 0.85
strxmovFunction · 0.85
allocMethod · 0.45

Tested by

no test coverage detected