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

Function write_execute_load_query_log_event

sql/sql_load.cc:867–1004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

865
866#ifndef EMBEDDED_LIBRARY
867static bool write_execute_load_query_log_event(THD *thd, const sql_exchange* ex,
868 const char* db_arg, /* table's database */
869 const char* table_name_arg,
870 bool is_concurrent,
871 enum enum_duplicates duplicates,
872 bool ignore,
873 bool transactional_table,
874 int errcode)
875{
876 char *load_data_query;
877 my_off_t fname_start, fname_end;
878 Item *item, *val;
879 int n;
880 StringBuffer<1024> query_str(system_charset_info);
881
882 query_str.append(STRING_WITH_LEN("LOAD DATA "));
883
884 if (is_concurrent)
885 query_str.append(STRING_WITH_LEN("CONCURRENT "));
886
887 fname_start= query_str.length();
888
889 if (thd->lex->local_file)
890 query_str.append(STRING_WITH_LEN("LOCAL "));
891 query_str.append(STRING_WITH_LEN("INFILE '"));
892 query_str.append_for_single_quote(ex->file_name, strlen(ex->file_name));
893 query_str.append(STRING_WITH_LEN("' "));
894
895 if (duplicates == DUP_REPLACE)
896 query_str.append(STRING_WITH_LEN("REPLACE "));
897 else if (ignore)
898 query_str.append(STRING_WITH_LEN("IGNORE "));
899
900 query_str.append(STRING_WITH_LEN("INTO"));
901
902 fname_end= query_str.length();
903
904 query_str.append(STRING_WITH_LEN(" TABLE "));
905 if (!thd->db.str || strcmp(db_arg, thd->db.str))
906 {
907 /*
908 If used database differs from table's database,
909 prefix table name with database name so that it
910 becomes a FQ name.
911 */
912 append_identifier(thd, &query_str, db_arg, strlen(db_arg));
913 query_str.append(STRING_WITH_LEN("."));
914 }
915 append_identifier(thd, &query_str, table_name_arg, strlen(table_name_arg));
916
917 if (ex->cs)
918 {
919 query_str.append(STRING_WITH_LEN(" CHARACTER SET "));
920 query_str.append(ex->cs->cs_name);
921 }
922
923 /* We have to create all optional fields as the default is not empty */
924 query_str.append(STRING_WITH_LEN(" FIELDS TERMINATED BY '"));

Callers 1

mysql_loadFunction · 0.85

Calls 11

strmakeMethod · 0.80
append_identifierFunction · 0.70
appendMethod · 0.45
lengthMethod · 0.45
append_ulonglongMethod · 0.45
is_emptyMethod · 0.45
get_load_data_outvarMethod · 0.45
ptrMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected