Skip to content

MDEV-40551 Copy/Paste friendly output format for MariaDB Command Line Client - #5632

Open
KhaledR57 wants to merge 1 commit into
mainfrom
bb-main-MDEV-40551
Open

MDEV-40551 Copy/Paste friendly output format for MariaDB Command Line Client#5632
KhaledR57 wants to merge 1 commit into
mainfrom
bb-main-MDEV-40551

Conversation

@KhaledR57

Copy link
Copy Markdown
Contributor

Copy/paste friendly output was only reachable by starting the client with --silent --skip-column-names, which cannot be done from a running interactive session.

Add \S, a statement terminator which prints the result of one statement in the tab separated format without column names.

com_silent() sets output_plain, opt_silent and column_names around com_go(), then restores them, the same way com_ego() handles vertical. output_plain selects print_tab_data() ahead of the vertical and table branches, so \S gives the same output whether the session was started plainly or with --table, --vertical or --silent. --html and --xml still win, matching \G.

… Client

Copy/paste friendly output was only reachable by starting the client with
--silent --skip-column-names, which cannot be done from a running
interactive session.

Add \S, a statement terminator which prints the result of one statement in
the tab separated format without column names.

com_silent() sets output_plain, opt_silent and column_names around
com_go(), then restores them, the same way com_ego() handles vertical.
output_plain selects print_tab_data() ahead of the vertical and table
branches, so \S gives the same output whether the session was started
plainly or with --table, --vertical or --silent. --html and --xml still
win, matching \G.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Multiline interactive history loses the \S terminator, and the tests only exercise batch mode.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds the \S statement terminator for tab-separated output without column names.

Changes:

  • Adds and implements the silent client command.
  • Prioritizes plain output over table and vertical formats.
  • Adds regression cases and expected results.
File summaries
File Description
client/mysql.cc Implements \S plain-output handling.
mysql-test/main/mysql.test Adds command behavior tests.
mysql-test/main/mysql.result Records expected test output.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread client/mysql.cc
bool old_output_plain=output_plain;
bool old_column_names=column_names;
opt_silent=1;
output_plain=1;
Comment on lines +38 to +39
--exec $MYSQL test -e "select 1 as a, 'x' as b;"
--exec $MYSQL test -e "select 1 as a, 'x' as b\S"

@midenok midenok left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address Copilot comments and rerequest Copilot review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants