~percona-dev/percona-server/release-5.1.49-12-rnt-pre

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# name       : mysql_remove_eol_carret.patch
# introduced : 12
# maintainer : Oleg
#
#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
diff -Nur a/client/client_priv.h b/client/client_priv.h
--- a/client/client_priv.h	2010-08-08 13:29:02.029339090 +0400
+++ b/client/client_priv.h	2010-08-08 13:29:02.928089044 +0400
@@ -92,5 +92,6 @@
   OPT_WRITE_BINLOG, OPT_DUMP_DATE,
   OPT_FIRST_SLAVE,
   OPT_ALL,
-  OPT_MAX_CLIENT_OPTION
+  OPT_MAX_CLIENT_OPTION,
+  OPT_REMOVE_EOL_CARRET
 };
diff -Nur a/client/mysql.cc b/client/mysql.cc
--- a/client/mysql.cc	2010-08-08 13:29:02.029339090 +0400
+++ b/client/mysql.cc	2010-08-08 13:29:03.669339041 +0400
@@ -141,6 +141,8 @@
 enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT};
 typedef enum enum_info_type INFO_TYPE;
 
+my_bool opt_remove_eol_carret=0;
+
 static MYSQL mysql;			/* The connection */
 static my_bool ignore_errors=0,wait_flag=0,quick=0,
                connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
@@ -1434,6 +1436,10 @@
    NO_ARG, 1, 0, 0, 0, 0, 0},  
   {"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"remove-eol-carret", OPT_REMOVE_EOL_CARRET, "Remove \\r before \\n in batch mode", 
+  (uchar**)&opt_remove_eol_carret , (uchar**)&opt_remove_eol_carret, 0, 
+   GET_BOOL,
+   NO_ARG, 0, 0, 0, 0, 0, 0},
   {"unbuffered", 'n', "Flush buffer after each query.", &unbuffered,
    &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
diff -Nur a/client/readline.cc b/client/readline.cc
--- a/client/readline.cc	2010-08-08 13:29:02.029339090 +0400
+++ b/client/readline.cc	2010-08-08 13:29:09.098089466 +0400
@@ -20,6 +20,8 @@
 #include <m_string.h>
 #include "my_readline.h"
 
+extern my_bool opt_remove_eol_carret;
+
 static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,
 			    ulong max_size);
 static bool init_line_buffer_from_string(LINE_BUFFER *buffer,char * str);
@@ -51,7 +53,7 @@
   if (!(pos=intern_read_line(line_buff,&out_length, truncated)))
     return 0;
   if (out_length && pos[out_length-1] == '\n')
-    if (--out_length && pos[out_length-1] == '\r')  /* Remove '\n' */
+    if (--out_length && opt_remove_eol_carret && pos[out_length-1] == '\r')  /* Remove '\n' */
       out_length--;                                 /* Remove '\r' */
   line_buff->read_length=out_length;
   pos[out_length]=0;
diff -Nur a/patch_info/mysql_remove_eol_carret.patch b/patch_info/mysql_remove_eol_carret.patch
--- a/patch_info/mysql_remove_eol_carret.patch	1970-01-01 03:00:00.000000000 +0300
+++ b/patch_info/mysql_remove_eol_carret.patch	2010-08-08 13:29:09.599338787 +0400
@@ -0,0 +1,8 @@
+File=mysql_remove_eol_carret.patch
+Name=
+Version=1.0
+Author=Percona <info@percona.com>
+License=GPL
+Comment=Do not remove carret before eol unless --remove-eol-carret is enabled in MySQL client.
+Changelog
+