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
|
# name : mysql_remove_eol_carret.patch
# introduced : 11 or before
# maintainer : Oleg
#
#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
diff -ruN a/client/client_priv.h b/client/client_priv.h
--- a/client/client_priv.h 2010-07-06 15:06:50.000000000 -0700
+++ b/client/client_priv.h 2010-07-06 15:07:18.000000000 -0700
@@ -95,5 +95,6 @@
#endif
OPT_FIRST_SLAVE,
OPT_ALL,
+ OPT_NO_REMOVE_EOL_CARRET,
OPT_MAX_CLIENT_OPTION
};
diff -ruN a/client/mysql.cc b/client/mysql.cc
--- a/client/mysql.cc 2010-06-03 08:50:02.000000000 -0700
+++ b/client/mysql.cc 2010-07-06 15:07:18.000000000 -0700
@@ -145,6 +145,8 @@
enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT};
typedef enum enum_info_type INFO_TYPE;
+my_bool opt_no_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,
@@ -1441,6 +1443,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},
+ {"no-remove-eol-carret", OPT_NO_REMOVE_EOL_CARRET, "Do not remove \\r before \\n in batch mode",
+ (uchar**)&opt_no_remove_eol_carret , (uchar**)&opt_no_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 -ruN a/client/readline.cc b/client/readline.cc
--- a/client/readline.cc 2010-06-03 08:50:23.000000000 -0700
+++ b/client/readline.cc 2010-07-06 15:07:18.000000000 -0700
@@ -21,6 +21,8 @@
#include <my_dir.h>
#include "my_readline.h"
+extern my_bool opt_no_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);
@@ -60,7 +62,7 @@
if (!(pos=intern_read_line(line_buff, &out_length)))
return 0;
if (out_length && pos[out_length-1] == '\n')
- if (--out_length && pos[out_length-1] == '\r') /* Remove '\n' */
+ if (--out_length && !opt_no_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 -ruN a/patch_info/mysql_remove_eol_carret.patch b/patch_info/mysql_remove_eol_carret.patch
--- a/patch_info/mysql_remove_eol_carret.patch 1969-12-31 16:00:00.000000000 -0800
+++ b/patch_info/mysql_remove_eol_carret.patch 2010-07-06 15:10:10.000000000 -0700
@@ -0,0 +1,7 @@
+File=mysql_remove_eol_carret.patch
+Name=
+Version=1.1
+Author=Percona <info@percona.com>
+License=GPL
+Comment=Do not remove carret before eol if --no-remove-eol-carret is enabled in MySQL client.
+Changelog
|