#At file:///home/cmiller/work/mysqlbzr/mysql-5.0-bugteam--bug37605/
2644 Chad MILLER 2008-06-25
Bug#37605, client displays wrong command prompt after # or -- comment in --comment
mode
modified:
client/mysql.cc
per-file messages:
client/mysql.cc
If we encounter a single-line comment, do not change the prompt.
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2008-06-24 16:05:56 +0000
+++ b/client/mysql.cc 2008-06-25 17:34:52 +0000
@@ -1035,7 +1035,7 @@ static void fix_history(String *final_co
static COMMANDS *find_command(char *name,char cmd_name);
static bool add_line(String &buffer,char *line,char *in_string,
- bool *ml_comment);
+ bool *ml_comment, bool *prompt_updated);
static void remove_cntrl(String &buffer);
static void print_table_data(MYSQL_RES *result);
static void print_table_data_html(MYSQL_RES *result);
@@ -1761,6 +1761,8 @@ static int read_and_execute(bool interac
String buffer;
#endif
+ const char *prompt= NULL;
+ bool prompt_updated= true;
char *line;
char in_string=0;
ulong line_number=0;
@@ -1790,15 +1792,19 @@ static int read_and_execute(bool interac
}
else
{
- char *prompt= (char*) (ml_comment ? " /*> " :
- glob_buffer.is_empty() ? construct_prompt() :
- !in_string ? " -> " :
- in_string == '\'' ?
- " '> " : (in_string == '`' ?
- " `> " :
- " \"> "));
+
+ if (prompt == NULL || prompt_updated)
+ {
+ if (ml_comment) { prompt= " /*> "; }
+ else if (glob_buffer.is_empty()) { prompt= construct_prompt(); }
+ else if (in_string == '\0') { prompt= " -> "; }
+ else if (in_string == '\'') { prompt= " '> "; }
+ else if (in_string == '`') { prompt= " `> "; }
+ else { prompt= " \"> "; }
+ }
+
if (opt_outfile && glob_buffer.is_empty())
- fflush(OUTFILE);
+ fflush(OUTFILE);
interrupted_query= 0;
@@ -1891,7 +1897,8 @@ static int read_and_execute(bool interac
#endif
continue;
}
- if (add_line(glob_buffer,line,&in_string,&ml_comment))
+ prompt_updated= true;
+ if (add_line(glob_buffer, line, &in_string, &ml_comment,
&prompt_updated))
break;
}
/* if in batch mode, send last query even if it doesn't end with \g or go */
@@ -1977,7 +1984,7 @@ static COMMANDS *find_command(char *name
static bool add_line(String &buffer,char *line,char *in_string,
- bool *ml_comment)
+ bool *ml_comment, bool *prompt_updated)
{
uchar inchar;
char buff[80], *pos, *out;
@@ -2106,6 +2113,7 @@ static bool add_line(String &buffer,char
// Add trailing single line comments to this statement
buffer.append(pos);
pos+= strlen(pos);
+ *prompt_updated= false;
}
pos--;
@@ -2144,6 +2152,7 @@ static bool add_line(String &buffer,char
// comment to end of line
if (preserve_comments)
buffer.append(pos);
+ *prompt_updated= false;
break;
}
| Thread |
|---|
| • bzr commit into mysql-5.0 branch (chad:2644) Bug#37605 | Chad MILLER | 25 Jun |