MCPcopy Create free account
hub / github.com/MariaDB/server / append_file_to_dir

Function append_file_to_dir

sql/sql_parse.cc:9394–9416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9392/** If pointer is not a null pointer, append filename to it. */
9393
9394bool append_file_to_dir(THD *thd, const char **filename_ptr,
9395 const LEX_CSTRING *table_name)
9396{
9397 char buff[FN_REFLEN],*ptr, *end;
9398 if (!*filename_ptr)
9399 return 0; // nothing to do
9400
9401 /* Check that the filename is not too long and it's a hard path */
9402 if (strlen(*filename_ptr)+table_name->length >= FN_REFLEN-1 ||
9403 !test_if_hard_path(*filename_ptr))
9404 {
9405 my_error(ER_WRONG_TABLE_NAME, MYF(0), *filename_ptr);
9406 return 1;
9407 }
9408 /* Fix is using unix filename format on dos */
9409 strmov(buff,*filename_ptr);
9410 end=convert_dirname(buff, *filename_ptr, NullS);
9411 if (unlikely(!(ptr= thd->alloc((size_t)(end-buff) + table_name->length + 1))))
9412 return 1; // End of memory
9413 *filename_ptr=ptr;
9414 strxmov(ptr,buff,table_name->str,NullS);
9415 return 0;
9416}
9417
9418
9419Comp_creator *comp_eq_creator(bool invert)

Callers 2

executeMethod · 0.85

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