List:Internals« Previous MessageNext Message »
From:kent Date:November 1 2005 9:47pm
Subject:bk commit into 5.1 tree (kent:1.1947)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kent. When kent 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
  1.1947 05/11/01 21:47:11 kent@stripped +4 -0
  Merge

  mysql-test/t/loaddata.test
    1.15 05/11/01 21:47:05 kent@stripped +8 -8

  mysql-test/r/loaddata.result
    1.20 05/11/01 21:46:36 kent@stripped +8 -8

  sql/sql_load.cc
    1.85 05/11/01 21:45:30 kent@stripped +0 -0
    Auto merged

  mysql-test/std_data/loaddata_dq.dat
    1.2 05/11/01 21:45:29 kent@stripped +0 -0
    Merge rename: mysql-test/std_data/loaddata5.dat ->
mysql-test/std_data/loaddata_dq.dat

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	kent
# Host:	c-7d4072d5.010-2112-6f72651.cust.bredbandsbolaget.se
# Root:	/Users/kent/mysql/bk/mysql-5.1/RESYNC

--- 1.84/sql/sql_load.cc	2005-10-06 10:26:01 +02:00
+++ 1.85/sql/sql_load.cc	2005-11-01 21:45:30 +01:00
@@ -1025,8 +1025,23 @@
 	  *to++= (byte) escape_char;
 	  goto found_eof;
 	}
-	*to++ = (byte) unescape((char) chr);
-	continue;
+        /*
+          When escape_char == enclosed_char, we treat it like we do for
+          handling quotes in SQL parsing -- you can double-up the
+          escape_char to include it literally, but it doesn't do escapes
+          like \n. This allows: LOAD DATA ... ENCLOSED BY '"' ESCAPED BY '"'
+          with data like: "fie""ld1", "field2"
+         */
+        if (escape_char != enclosed_char || chr == escape_char)
+        {
+          *to++ = (byte) unescape((char) chr);
+          continue;
+        }
+        else
+        {
+          PUSH(chr);
+          chr= escape_char;
+        }
       }
 #ifdef ALLOW_LINESEPARATOR_IN_STRINGS
       if (chr == line_term_char)

--- 1.19/mysql-test/r/loaddata.result	2005-09-23 14:37:18 +02:00
+++ 1.20/mysql-test/r/loaddata.result	2005-11-01 21:46:36 +01:00
@@ -66,6 +66,14 @@
 3	row 3
 0	
 drop table t1;
+create table t1 (a varchar(20), b varchar(20));
+load data infile '../../std_data/loaddata_dq.dat' into table t1 fields terminated by ','
enclosed by '"' escaped by '"' (a,b);
+select * from t1;
+a	b
+field1	field2
+a"b	cd"ef
+a"b	c"d"e
+drop table t1;
 SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
 create table t1(id integer not null auto_increment primary key);
 insert into t1 values(0);

--- 1.14/mysql-test/t/loaddata.test	2005-09-23 14:37:18 +02:00
+++ 1.15/mysql-test/t/loaddata.test	2005-11-01 21:47:05 +01:00
@@ -31,6 +31,14 @@
 select * from t1;
 drop table t1;
 
+#
+# Bug #11203: LOAD DATA does not accept same characters for ESCAPED and
+# ENCLOSED
+#
+create table t1 (a varchar(20), b varchar(20));
+load data infile '../../std_data/loaddata_dq.dat' into table t1 fields terminated by ','
enclosed by '"' escaped by '"' (a,b);
+select * from t1;
+drop table t1;
 
 #
 # Bug #12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
Thread
bk commit into 5.1 tree (kent:1.1947)kent1 Nov