diff options
author | unknown <gshchepa/uchum@gleb.loc> | 2007-07-06 03:43:23 +0500 |
---|---|---|
committer | unknown <gshchepa/uchum@gleb.loc> | 2007-07-06 03:43:23 +0500 |
commit | 725b49716b2bfb88361f37df2fd882578998b131 (patch) | |
tree | 38e72a5d8c618981a5dbae64c641605be1408d86 /sql/sql_class.h | |
parent | e0f93ca8c1955cc2766c224703a278e66d9c05bc (diff) | |
download | mariadb-git-725b49716b2bfb88361f37df2fd882578998b131.tar.gz |
Fixed bug #29442.
The SELECT INTO OUTFILE FIELDS ENCLOSED BY digit or minus sign,
followed by the same LOAD DATA INFILE statement, used wrond encoding
of non-string fields contained the enclosed character in their text
representation.
Example:
SELECT 15, 9 INTO OUTFILE 'text' FIELDS ENCLOSED BY '5';
Old encoded result in the text file:
5155 595
^ was decoded as the 1st enclosing character of the 2nd field;
^ was skipped as garbage;
^ ^ was decoded as a pair of englosing characters of the 1st field;
^ was decoded as traling space of the first field;
^^ was decoded as a doubled enclosed character.
New encoded result in the text file:
51\55 595
^ ^ pair of enclosing characters of the 1st field;
^^ escaped enclosed character.
sql/sql_class.h:
Fixed bug #29442.
The NUMERIC_CHARS macro constant has been defined to enumerate
all possible characters of a numeric value text representation.
The select_export::is_unsafe_field_sep boolean flag has been added
to apply the encoding algorithm to non-string values when it is
necessary.
sql/sql_class.cc:
Fixed bug #29442.
The select_export::send_data method has been modified to encode text
representation of fields of all data types like string fields.
mysql-test/t/loaddata.test:
Updated test case for bug #29442.
mysql-test/r/loaddata.result:
Updated test case for bug #29442.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 23c499aea07..a5cbc21684f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1929,6 +1929,12 @@ public: #define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape +/* + List of all possible characters of a numeric value text representation. +*/ +#define NUMERIC_CHARS ".0123456789e+-" + + class select_export :public select_to_file { uint field_term_length; int field_sep_char,escape_char,line_sep_char; @@ -1938,6 +1944,12 @@ class select_export :public select_to_file { (see the READ_INFO::unescape method and the ESCAPE_CHARS constant value). */ bool is_ambiguous_field_sep; + /* + The is_unsafe_field_sep field is true if a value of the field_sep_char + field is one of the '0'..'9', '+', '-', '.' and 'e' characters + (see the NUMERIC_CHARS constant value). + */ + bool is_unsafe_field_sep; bool fixed_row_size; public: select_export(sql_exchange *ex) :select_to_file(ex) {} |