fixed 'STARTING BY' in replication

parent d2bfaed9
......@@ -7,7 +7,7 @@ slave start;
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' ignore 1 lines;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
select * from t1;
......
2003-01-21,6328,%a%,%aaaaa%
>2003-01-21,6328,%a%,%aaaaa%
##
2003-02-22,2461,b,%a a a @@ @% @b ' " a%
>2003-02-22,2461,b,%a a a @@ @% @b ' " a%
##
2003-03-22,2161,%c%,%asdf%
>2003-03-22,2161,%c%,%asdf%
##
2003-04-22,2416,%a%,%bbbbb%
>2003-04-22,2416,%a%,%bbbbb%
##
......@@ -10,8 +10,7 @@ create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
#load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionaly enclosed by '%' escaped by '@' lines terminated by '\n%%\n' ignore 1 lines;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' ignore 1 lines;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
......
......@@ -309,15 +309,19 @@ void Load_log_event::pack_info(String* packet)
pretty_print_str(&tmp, sql_ex.escaped, sql_ex.escaped_len);
}
bool line_lexem_added= false;
if (sql_ex.line_term_len)
{
tmp.append(" LINES TERMINATED BY ");
pretty_print_str(&tmp, sql_ex.line_term, sql_ex.line_term_len);
line_lexem_added= true;
}
if (sql_ex.line_start_len)
{
tmp.append(" LINES STARTING BY ");
if (!line_lexem_added)
tmp.append(" LINES");
tmp.append(" STARTING BY ");
pretty_print_str(&tmp, sql_ex.line_start, sql_ex.line_start_len);
}
......@@ -1299,15 +1303,19 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
pretty_print_str(file, sql_ex.escaped, sql_ex.escaped_len);
}
bool line_lexem_added= false;
if (sql_ex.line_term)
{
fprintf(file," LINES TERMINATED BY ");
pretty_print_str(file, sql_ex.line_term, sql_ex.line_term_len);
line_lexem_added= true;
}
if (sql_ex.line_start)
{
fprintf(file," LINES STARTING BY ");
if (!line_lexem_added)
fprintf(file," LINES");
fprintf(file," STARTING BY ");
pretty_print_str(file, sql_ex.line_start, sql_ex.line_start_len);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment