Bug #3068 | [Prompt without seconds when set from INI file] | ||
---|---|---|---|
Submitted: | 4 Mar 2004 16:41 | Modified: | 8 Mar 2004 13:53 |
Reporter: | Paul DuBois | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
Version: | 4.0.19 | OS: | |
Assigned to: | Paul DuBois | CPU Architecture: | Any |
[4 Mar 2004 16:41]
Paul DuBois
[4 Mar 2004 17:01]
Paul DuBois
Upon further reflection, it would appear that \s turning into a space is probably a result of \s being interepreted as an escape sequence -- which is normal for the way that MySQL interprets strings. You can get seconds by using \\s in the option file argument. However, this is still problematic: - You don't need an extra backslash before the other special prompt sequences (\R, \m). - If you do add a backslash before \R and \m, they still work. In addition (an unrelated problem), seconds displays using only one digit when the seconds value is < 10.
[7 Mar 2004 4:21]
Sergei Golubchik
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.mysql.com/documentation/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php Additional info: Though, I agree that is it confusing in this particular case, it is not a bug: http://www.mysql.com/doc/en/Option_files.html " Note that for options and values, all leading and trailing blanks are automatically deleted. You may use the escape sequences `\b', `\t', `\n', `\r', `\\', and `\s' in option values to represent the backspace, tab, newline, carriage return, and space characters. " Paul, may be you can clarify it, where mysql prompt variable it documented ?
[7 Mar 2004 12:24]
Paul DuBois
Okay, I've added this text to the manual: Note that if you set the prompt using a @code{--prompt} option in an option file, it is advisable to double the backslashes when using the special prompt options. Otherwise, you may run into problems because there is some overlap in the set of allowable prompt options and the set of special escape sequences that are recognized in option files. These sequences are listed in @ref{Option files}. Still, what about the problem that seconds displays only as a single digit for seconds values < 10? That looks pretty weird.
[7 Mar 2004 18:41]
Paul DuBois
Here is a patch to cause \s in the prompt to always display with two digits. It actually causes hours to display with two digits as well. (That way, times in the prompt have a constant width.) I guess it's debatable whether that should happen for the hours value, but having seconds display with a single digit sometimes is just wrong. :-) This patch actually applies against either the 4.0 or 4.1 tree. ===== mysql.cc 1.160 vs edited ===== --- 1.160/client/mysql.cc Wed Mar 3 14:51:00 2004 +++ edited/mysql.cc Sun Mar 7 20:29:12 2004 @@ -3183,6 +3183,8 @@ processed_prompt.append(' '); break; case 'R': + if (t->tm_hour < 10) + processed_prompt.append('0'); add_int_to_prompt(t->tm_hour); break; case 'r': @@ -3190,6 +3192,8 @@ getHour = t->tm_hour % 12; if (getHour == 0) getHour=12; + if (getHour < 10) + processed_prompt.append('0'); add_int_to_prompt(getHour); break; case 'm': @@ -3215,6 +3219,8 @@ processed_prompt.append(strtok(dateTime,"\n")); break; case 's': + if (t->tm_sec < 10) + processed_prompt.append('0'); add_int_to_prompt(t->tm_sec); break; case 'w':
[8 Mar 2004 13:32]
Sergei Golubchik
Paul, could you please push this patch in 4.0.19 and close the bug ?
[8 Mar 2004 13:53]
Paul DuBois
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html