Below is the list of changes that have just been committed into a local
5.0 repository of uchum. When uchum does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-07-05 21:31:57+05:00, gshchepa@stripped +3 -0
Fixed bug #29442.
The SELECT INTO OUTFILE FIELDS ENCLOSED BY digit or minus sign,
followed by the same LOAD DATA INFILE statement, corrupted non-string
fields contained the enclosed character in their text representation.
mysql-test/r/loaddata.result@stripped, 2007-07-05 21:21:25+05:00, gshchepa@stripped +14 -0
Updated test case for bug #29442.
mysql-test/t/loaddata.test@stripped, 2007-07-05 21:21:04+05:00, gshchepa@stripped +25 -0
Updated test case for bug #29442.
sql/sql_class.cc@stripped, 2007-07-05 20:31:48+05:00, gshchepa@stripped +1 -1
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.
diff -Nrup a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
--- a/mysql-test/r/loaddata.result 2007-07-04 03:15:11 +05:00
+++ b/mysql-test/r/loaddata.result 2007-07-05 21:21:25 +05:00
@@ -238,3 +238,17 @@ f1
1
2
drop table t1,t2;
+CREATE TABLE t1 (c1 INT, c2 INT, c3 DATE, c4 INT);
+INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, 9, 0, 9);
+SELECT * FROM t1;
+c1 c2 c3 c4
+10 9 0000-00-00 9
+SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '0' FROM t1;
+01000 090 000000000-0000-00000 090
+EOF
+TRUNCATE t1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '0';
+SELECT * FROM t1;
+c1 c2 c3 c4
+10 9 0000-00-00 9
+DROP TABLE t1;
diff -Nrup a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
--- a/mysql-test/t/loaddata.test 2007-07-04 03:14:46 +05:00
+++ b/mysql-test/t/loaddata.test 2007-07-05 21:21:04 +05:00
@@ -213,4 +213,29 @@ select f1 from t1 where f2 <> '0000-00-0
--exec rm $MYSQLTEST_VARDIR/tmp/t2
drop table t1,t2;
+#
+# Bug#29442: SELECT INTO OUTFILE FIELDS ENCLOSED BY digit, minus sign etc
+# corrupts non-string fields containing this character.
+#
+
+CREATE TABLE t1 (c1 INT, c2 INT, c3 DATE, c4 INT);
+
+INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, 9, 0, 9);
+SELECT * FROM t1;
+
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '0' FROM t1;
+--exec cat $MYSQLTEST_VARDIR/tmp/t1
+--exec echo EOF
+
+TRUNCATE t1;
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '0';
+SELECT * FROM t1;
+
+--exec rm $MYSQLTEST_VARDIR/tmp/t1
+DROP TABLE t1;
+
# End of 5.0 tests
diff -Nrup a/sql/sql_class.cc b/sql/sql_class.cc
--- a/sql/sql_class.cc 2007-07-04 02:05:51 +05:00
+++ b/sql/sql_class.cc 2007-07-05 20:31:48 +05:00
@@ -1284,7 +1284,7 @@ bool select_export::send_data(List<Item>
used_length=min(res->length(),item->max_length);
else
used_length=res->length();
- if (result_type == STRING_RESULT && escape_char != -1)
+ if (escape_char != -1)
{
char *pos, *start, *end;
CHARSET_INFO *res_charset= res->charset();
| Thread |
|---|
| • bk commit into 5.0 tree (gshchepa:1.2518) BUG#29442 | gshchepa | 5 Jul |