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

Function read_fixed_length

sql/sql_load.cc:1012–1138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1010****************************************************************************/
1011
1012static int
1013read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
1014 List<Item> &fields_vars, List<Item> &set_fields,
1015 List<Item> &set_values, READ_INFO &read_info,
1016 ulong skip_lines, bool ignore_check_option_errors)
1017{
1018 List_iterator_fast<Item> it(fields_vars);
1019 Item *item;
1020 TABLE *table= table_list->table;
1021 bool err= false, progress_reports;
1022 ulonglong counter, time_to_report_progress;
1023 DBUG_ENTER("read_fixed_length");
1024
1025 counter= 0;
1026 time_to_report_progress= MY_HOW_OFTEN_TO_WRITE/10;
1027 progress_reports= 1;
1028 if ((thd->progress.max_counter= read_info.file_length()) == ~(my_off_t) 0)
1029 progress_reports= 0;
1030
1031 Write_record write(thd, table, &info, NULL);
1032
1033 while (!read_info.read_fixed_length())
1034 {
1035 if (thd->killed)
1036 {
1037 thd->send_kill_message();
1038 DBUG_RETURN(1);
1039 }
1040 if (progress_reports)
1041 {
1042 thd->progress.counter= read_info.position();
1043 if (++counter >= time_to_report_progress)
1044 {
1045 time_to_report_progress+= MY_HOW_OFTEN_TO_WRITE/10;
1046 thd_progress_report(thd, thd->progress.counter,
1047 thd->progress.max_counter);
1048 }
1049 }
1050 if (skip_lines)
1051 {
1052 /*
1053 We could implement this with a simple seek if:
1054 - We are not using DATA INFILE LOCAL
1055 - escape character is ""
1056 - line starting prefix is ""
1057 */
1058 skip_lines--;
1059 continue;
1060 }
1061 it.rewind();
1062 uchar *pos=read_info.row_start;
1063#ifdef HAVE_valgrind
1064 read_info.row_end[0]=0;
1065#endif
1066
1067 restore_default_record_for_insert(table);
1068 while ((item= it++))
1069 {

Callers 1

mysql_loadFunction · 0.85

Calls 15

thd_progress_reportFunction · 0.85
push_warning_printfFunction · 0.85
file_lengthMethod · 0.80
read_fixed_lengthMethod · 0.80
send_kill_messageMethod · 0.80
get_stmt_daMethod · 0.80
view_check_optionMethod · 0.80
next_lineMethod · 0.80
positionMethod · 0.45
rewindMethod · 0.45

Tested by

no test coverage detected