diff options
author | gshchepa/uchum@gleb.loc <> | 2007-07-03 19:37:46 +0500 |
---|---|---|
committer | gshchepa/uchum@gleb.loc <> | 2007-07-03 19:37:46 +0500 |
commit | dbe4fb94cad60318d54db399206848310e1fc9d3 (patch) | |
tree | 225544d55fd087e00370cd901b8bd353467a3e62 /sql/sql_class.h | |
parent | f8bf427ba41df2aa4b19667e7b8c2d64a85b6074 (diff) | |
download | mariadb-git-dbe4fb94cad60318d54db399206848310e1fc9d3.tar.gz |
Fixed bug #29294.
The `SELECT 'r' INTO OUTFILE ... FIELDS ENCLOSED BY 'r' ' statement
encoded the 'r' string to a 4 byte string of value x'725c7272'
(sequence of 4 characters: r\rr).
The LOAD DATA statement decoded this string to a 1 byte string of
value x'0d' (ASCII Carriage Return character) instead of the original
'r' character.
The same error also happened with the FIELDS ENCLOSED BY clause
followed by special characters: 'n', 't', 'r', 'b', '0', 'Z' and 'N'.
NOTE 1: This is a result of the undocumented feature: the LOAD DATA INFILE
recognises 2-byte input sequences like \n, \t, \r and \Z in addition
to documented 2-byte sequences: \0 and \N. This feature should be
documented (here backspace character is a default ESCAPED BY character,
in the real-life example it may be any ESCAPED BY character).
NOTE 2, changed behaviour:
Now the `SELECT INTO OUTFILE' statement with the `FIELDS ENCLOSED BY'
clause followed by one of: 'n', 't', 'r', 'b', '0', 'Z' or 'N' characters
encodes this special character itself by doubling it ('r' --> 'rr'),
not by prepending it with an escape character.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index db6f65cab55..eb2c8637651 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1224,9 +1224,18 @@ public: }; +#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape + + class select_export :public select_to_file { uint field_term_length; int field_sep_char,escape_char,line_sep_char; + /* + The is_ambiguous_field_sep field is true if a value of the field_sep_char + field is one of the 'n', 't', 'r' etc characters + (see the READ_INFO::unescape method and the ESCAPE_CHARS constant value). + */ + bool is_ambiguous_field_sep; bool fixed_row_size; public: select_export(sql_exchange *ex) :select_to_file(ex) {} |