Merge lp:~linuxjedi/drizzle/trunk-bug-733587 into lp:drizzle/7.0

Proposed by Andrew Hutchings
Status: Merged
Approved by: Brian Aker
Approved revision: 2235
Merged at revision: 2237
Proposed branch: lp:~linuxjedi/drizzle/trunk-bug-733587
Merge into: lp:drizzle/7.0
Diff against target: 73 lines (+15/-32)
1 file modified
client/drizzle.cc (+15/-32)
To merge this branch: bzr merge lp:~linuxjedi/drizzle/trunk-bug-733587
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+53225@code.launchpad.net

Description of the change

Backport of http://bugs.mysql.com/bug.php?id=33812 to fix delimiter keyword in drizzle client

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/drizzle.cc'
2--- client/drizzle.cc 2011-03-11 12:09:47 +0000
3+++ client/drizzle.cc 2011-03-14 11:51:25 +0000
4@@ -2204,7 +2204,6 @@
5 return(0);
6 if (status.getAddToHistory() && line[0] && not_in_history(line))
7 add_history(line);
8- char *end_of_line=line+(uint32_t) strlen(line);
9
10 for (pos=out=line ; (inchar= (unsigned char) *pos) ; pos++)
11 {
12@@ -2298,37 +2297,6 @@
13 continue;
14 }
15 }
16- else if (!*ml_comment && !*in_string &&
17- (end_of_line - pos) >= 10 &&
18- !strncmp(pos, "delimiter ", 10))
19- {
20- // Flush previously accepted characters
21- if (out != line)
22- {
23- buffer->append(line, (out - line));
24- out= line;
25- }
26-
27- // Flush possible comments in the buffer
28- if (!buffer->empty())
29- {
30- if (com_go(buffer, 0) > 0) // < 0 is not fatal
31- return(1);
32- assert(buffer!=NULL);
33- buffer->clear();
34- }
35-
36- /*
37- Delimiter wants the get rest of the given line as argument to
38- allow one to change ';' to ';;' and back
39- */
40- buffer->append(pos);
41- if (com_delimiter(buffer, pos) > 0)
42- return(1);
43-
44- buffer->clear();
45- break;
46- }
47 else if (!*ml_comment && !*in_string && !strncmp(pos, delimiter,
48 strlen(delimiter)))
49 {
50@@ -2388,8 +2356,23 @@
51
52 // comment to end of line
53 if (preserve_comments)
54+ {
55+ bool started_with_nothing= !buffer->empty();
56 buffer->append(pos);
57
58+ /*
59+ A single-line comment by itself gets sent immediately so that
60+ client commands (delimiter, status, etc) will be interpreted on
61+ the next line.
62+ */
63+ if (started_with_nothing)
64+ {
65+ if (com_go(buffer, 0) > 0) // < 0 is not fatal
66+ return 1;
67+ buffer->clear();
68+ }
69+ }
70+
71 break;
72 }
73 else if (!*in_string && inchar == '/' && *(pos+1) == '*' &&

Subscribers

People subscribed via source and target branches