Bug #88020 Expose connection status in command-line client prompt
Submitted: 7 Oct 2017 15:27 Modified: 11 Oct 2017 7:39
Reporter: Alexey Kopytov Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: Command Line Client, connection status, MySQL

[7 Oct 2017 15:27] Alexey Kopytov
Description:
The MySQL client API provides a number of flags describing the
connection status:

https://dev.mysql.com/doc/dev/mysql-server/8.0.3/mysql__com_8h.html#a1d854e841086925be1883...

Sometimes it might be convenient to have access to some of those flags
in interactive sessions from the command-line client. For example,
having some indicators in the command line prompt for the following
flags might be useful:

SERVER_STATUS_IN_TRANS,
SERVER_STATUS_IN_TRANS_READONLY,
SERVER_STATUS_AUTOCOMMIT,
SERVER_QUERY_NO_GOOD_INDEX_USED,
SERVER_QUERY_NO_INDEX_USED,
SERVER_STATUS_DB_DROPPED,
SERVER_STATUS_NO_BACKSLASH_ESCAPES,
SERVER_SESSION_STATE_CHANGED

The command-line client already provides a way to customize the prompt
via the 'prompt' command. This is a feature request to introduce a new
special sequence for that command to expose connection status flags in
the prompt.

How to repeat:
See above.
[10 Oct 2017 13:57] OCA Admin
Contribution submitted via Github - Bug #88020: Expose connection status flags in command-line client prompt 
(*) Contribution by Alexey Kopytov (Github akopytov, mysql-server/pull/171#issuecomment-335449822): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_145505256.txt (text/plain), 3.56 KiB.

[11 Oct 2017 7:39] MySQL Verification Team
Hello Alexey,

Thank you for the feature request and patch.

Regards,
Umesh
[11 Oct 2017 7:43] MySQL Verification Team
http://kaamos.me/blog/2017/10/09/connection_status_in_mysql_cli.html