870
870
while ( to < end_of_buff)
874
873
if ((my_mbcharlen(read_charset, chr) > 1) &&
875
874
to+my_mbcharlen(read_charset, chr) <= end_of_buff)
877
unsigned char* p = (unsigned char*)to;
879
int ml = my_mbcharlen(read_charset, chr);
881
for (i=1; i<ml; i++) {
887
if (my_ismbchar(read_charset,
892
PUSH((unsigned char) *--to);
876
unsigned char* p = (unsigned char*)to;
878
int ml = my_mbcharlen(read_charset, chr);
880
for (i=1; i<ml; i++) {
886
if (my_ismbchar(read_charset,
891
PUSH((unsigned char) *--to);
896
894
if (chr == my_b_EOF)
898
896
if (chr == escape_char)
900
if ((chr=GET) == my_b_EOF)
902
*to++= (unsigned char) escape_char;
898
if ((chr=GET) == my_b_EOF)
900
*to++= (unsigned char) escape_char;
906
904
When escape_char == enclosed_char, we treat it like we do for
907
905
handling quotes in SQL parsing -- you can double-up the
920
918
#ifdef ALLOW_LINESEPARATOR_IN_STRINGS
921
919
if (chr == line_term_char)
923
if (chr == line_term_char && found_enclosed_char == INT_MAX)
921
if (chr == line_term_char && found_enclosed_char == INT_MAX)
926
if (terminator(line_term_ptr,line_term_length))
927
{ // Maybe unexpected linefeed
924
if (terminator(line_term_ptr,line_term_length))
925
{ // Maybe unexpected linefeed
935
933
if (chr == found_enclosed_char)
937
if ((chr=GET) == found_enclosed_char)
938
{ // Remove dupplicated
939
*to++ = (unsigned char) chr;
942
// End of enclosed field if followed by field_term or line_term
943
if (chr == my_b_EOF ||
944
(chr == line_term_char && terminator(line_term_ptr, line_term_length)))
945
{ // Maybe unexpected linefeed
952
if (chr == field_term_char &&
953
terminator(field_term_ptr,field_term_length))
961
The string didn't terminate yet.
962
Store back next character for the loop
965
/* copy the found term character to 'to' */
966
chr= found_enclosed_char;
935
if ((chr=GET) == found_enclosed_char)
936
{ // Remove dupplicated
937
*to++ = (unsigned char) chr;
940
// End of enclosed field if followed by field_term or line_term
941
if (chr == my_b_EOF ||
942
(chr == line_term_char && terminator(line_term_ptr, line_term_length)))
943
{ // Maybe unexpected linefeed
950
if (chr == field_term_char &&
951
terminator(field_term_ptr,field_term_length))
959
The string didn't terminate yet.
960
Store back next character for the loop
963
/* copy the found term character to 'to' */
964
chr= found_enclosed_char;
968
966
else if (chr == field_term_char && found_enclosed_char == INT_MAX)
970
if (terminator(field_term_ptr,field_term_length))
968
if (terminator(field_term_ptr,field_term_length))
978
976
*to++ = (unsigned char) chr;
981
** We come here if buffer is too small. Enlarge it and continue
979
** We come here if buffer is too small. Enlarge it and continue
983
981
if (!(new_buffer=(unsigned char*) realloc(buffer, buff_length+1+IO_SIZE)))
984
982
return (error=1);
985
983
to=new_buffer + (to-buffer);
1081
if (my_mbcharlen(read_charset, chr) > 1)
1084
chr != my_b_EOF && i<my_mbcharlen(read_charset, chr);
1087
if (chr == escape_char)
1091
if (chr == my_b_EOF)
1078
if (my_mbcharlen(read_charset, chr) > 1)
1081
chr != my_b_EOF && i<my_mbcharlen(read_charset, chr);
1084
if (chr == escape_char)
1087
if (chr == my_b_EOF)