Bug #37605 client displays wrong command prompt after # or -- comment in --comment mode

Submitted: 24 Jun 2008 12:48 Modified: 7 Dec 2012 8:46
Reporter: Gleb Shchepa Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0+, 5.1.25 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[24 Jun 2008 12:48] Gleb Shchepa
Description:
In the "preserve commentary" mode mysql client shows the "    ->" command prompt (extension of previous line) after _single-line_ commentaries:

mysql command line client uses several command prompts dependi
mysql> -- test
    -> this line looks like extension of _single-line_ commentary!

mysql client without -c option treats single-line comments as expected:

mysql> -- test
mysql>

How to repeat:
$ mysql -c
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 24
Server version: 5.0.66-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> -- test
    -> SELECT 1;
+---+
| 1 |
+---+
| 1 | 
+---+
1 row in set (0.00 sec)

Suggested fix:
Looks like mysql client should clean glob_buffer before printing of a command prompt, if this buffer contains nothing but a single-line commentary.
[24 Jun 2008 13:04] Valeriy Kravchuk
Thank you for a bug report. Verified just as described, also - with client from 5.1.25.
[25 Jun 2008 17:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/48514

2644 Chad MILLER	2008-06-25
      Bug#37605, client displays wrong command prompt after # or -- comment \
      	in --comment mode
      
      In comment-preservation mode of the mysql command-line client, comments are
      not discarded by the client, and are sent to the server.  This fooled the 
      code that tracks what state the prompt should be in.
      
      Now, keep a new state variable that tells us whether we should update 
      the state of the prompt or not.  After single-line comments, the next
      prompt should always be the previous state.  Rather than keep up with
      that, let's only conditionally update the prompt.
[4 Jul 2008 17:17] Chad MILLER
Jimw says this is not a bug, as the prompt should follow protocol state in addition to SQL-level quote state.  If we're in comment-preservation mode, and type a comment, then we accumulate stuff that we have not yet sent to the server.

Omer will bring it up at some meeting.  Since its bug-itude is in question, I'm setting back to Open.
[7 Dec 2012 8:46] Gleb Shchepa
Closing: can't repeat this bug on 5.1+ any more.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.059 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.