mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed bug #32533.
8bit escape characters, termination and enclosed characters were silently ignored by SELECT INTO query, but LOAD DATA INFILE algorithm is 8bit-clean, so data was corrupted during encoding.
This commit is contained in:
@ -1219,16 +1219,18 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
|
||||
}
|
||||
}
|
||||
field_term_length=exchange->field_term->length();
|
||||
field_term_char= field_term_length ? (*exchange->field_term)[0] : INT_MAX;
|
||||
field_term_char= field_term_length ?
|
||||
(int) (uchar) (*exchange->field_term)[0] : INT_MAX;
|
||||
if (!exchange->line_term->length())
|
||||
exchange->line_term=exchange->field_term; // Use this if it exists
|
||||
field_sep_char= (exchange->enclosed->length() ? (*exchange->enclosed)[0] :
|
||||
field_term_char);
|
||||
escape_char= (exchange->escaped->length() ? (*exchange->escaped)[0] : -1);
|
||||
field_sep_char= (exchange->enclosed->length() ?
|
||||
(int) (uchar) (*exchange->enclosed)[0] : field_term_char);
|
||||
escape_char= (exchange->escaped->length() ?
|
||||
(int) (uchar) (*exchange->escaped)[0] : -1);
|
||||
is_ambiguous_field_sep= test(strchr(ESCAPE_CHARS, field_sep_char));
|
||||
is_unsafe_field_sep= test(strchr(NUMERIC_CHARS, field_sep_char));
|
||||
line_sep_char= (exchange->line_term->length() ?
|
||||
(*exchange->line_term)[0] : INT_MAX);
|
||||
(int) (uchar) (*exchange->line_term)[0] : INT_MAX);
|
||||
if (!field_term_length)
|
||||
exchange->opt_enclosed=0;
|
||||
if (!exchange->enclosed->length())
|
||||
@ -1385,10 +1387,11 @@ bool select_export::send_data(List<Item> &items)
|
||||
Don't escape field_term_char by doubling - doubling is only
|
||||
valid for ENCLOSED BY characters:
|
||||
*/
|
||||
(enclosed || !is_ambiguous_field_term || *pos != field_term_char))
|
||||
(enclosed || !is_ambiguous_field_term ||
|
||||
(int) (uchar) *pos != field_term_char))
|
||||
{
|
||||
char tmp_buff[2];
|
||||
tmp_buff[0]= ((int) *pos == field_sep_char &&
|
||||
tmp_buff[0]= ((int) (uchar) *pos == field_sep_char &&
|
||||
is_ambiguous_field_sep) ?
|
||||
field_sep_char : escape_char;
|
||||
tmp_buff[1]= *pos ? *pos : '0';
|
||||
|
Reference in New Issue
Block a user