List:Commits« Previous MessageNext Message »
From:Sergei Golubchik Date:July 3 2007 3:41pm
Subject:Re: bk commit into 4.1 tree (gshchepa:1.2671) BUG#29294
View as plain text  
Hi!

On Jun 29, gshchepa@stripped wrote:
> ChangeSet@stripped, 2007-06-29 16:40:46+05:00, gshchepa@stripped +4 -0
>   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'.

ok to push
with a couple of small changes, see below.
   
> diff -Nrup a/sql/sql_class.cc b/sql/sql_class.cc
> --- a/sql/sql_class.cc	2007-03-20 21:59:23 +04:00
> +++ b/sql/sql_class.cc	2007-06-29 16:37:16 +05:00
> @@ -1113,7 +1114,10 @@ bool select_export::send_data(List<Item>
>  	      (int) *pos == line_sep_char || !*pos)
>  	  {
>  	    char tmp_buff[2];
> -	    tmp_buff[0]= escape_char;
> +            if ((int) *pos == field_sep_char && is_ambiguous_field_sep)
> +              tmp_buff[0]= field_sep_char;
> +            else
> +              tmp_buff[0]= escape_char;

it's recommended to use ?: instead of if():

   tmp_buff[0]= ... ? field_sep_char : escape_char;

it highlights the fact that you assign a value to tmp_buff[0], and
the value is chosen based on a condition. With if() one needs to compare
visually two branches to understand that.

>  	    tmp_buff[1]= *pos ? *pos : '0';
> diff -Nrup a/sql/sql_class.h b/sql/sql_class.h
> --- a/sql/sql_class.h	2007-01-15 13:58:02 +04:00
> +++ b/sql/sql_class.h	2007-06-29 16:34:41 +05:00
> @@ -1224,9 +1224,18 @@ public:
>  };
>  
>  
> +#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescaped

1. Typo. it's READ_INFO::unescape
2. Please add a similar comment to the READ_INFO::unescape method

Regards / Mit vielen Grüssen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Developer
/_/  /_/\_, /___/\___\_\___/  MySQL GmbH, Radlkoferstr. 2, D-81373 München
       <___/                  Geschäftsführer: Kaj Arnö - HRB
München 162140
Thread
bk commit into 4.1 tree (gshchepa:1.2671) BUG#29294gshchepa29 Jun
  • Re: bk commit into 4.1 tree (gshchepa:1.2671) BUG#29294Sergei Golubchik3 Jul