From f04275651994fbe4c5c6da3c8d911825130e0b61 Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Thu, 14 Apr 2022 06:53:47 -0400 Subject: [PATCH] Fix #5123. Document query reults with pretty formatting (#5124) --- src/Commands/sql/SqlCommands.php | 4 +++- src/Sql/SqlBase.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Commands/sql/SqlCommands.php b/src/Commands/sql/SqlCommands.php index 87912873f4..d030341913 100644 --- a/src/Commands/sql/SqlCommands.php +++ b/src/Commands/sql/SqlCommands.php @@ -168,12 +168,14 @@ public function cli(InputInterface $input, $options = ['extra' => self::REQ]): v * Browse user record. Table prefixes, if used, must be added to table names by hand. * @usage drush sql:query --db-prefix "SELECT * FROM {users}" * Browse user record. Table prefixes are honored. Caution: All curly-braces will be stripped. - * @usage $(drush sql-connect) < example.sql + * @usage $(drush sql:connect) < example.sql * Import sql statements from a file into the current database. * @usage drush sql:query --file=example.sql * Alternate way to import sql statements from a file. * @usage drush ev "return db_query('SELECT * FROM users')->fetchAll()" --format=json * Get data back in JSON format. See https://github.com/drush-ops/drush/issues/3071#issuecomment-347929777. + * @usage `drush sql:connect` -e "select * from users limit 5;" + * Results are formatted in a pretty table with borders and column headers. * @bootstrap max configuration * */ diff --git a/src/Sql/SqlBase.php b/src/Sql/SqlBase.php index f6c148345b..4a92db7d8e 100644 --- a/src/Sql/SqlBase.php +++ b/src/Sql/SqlBase.php @@ -632,8 +632,8 @@ public function alwaysQueryCommand($input_file): array return [ $this->command(), $this->creds(!$this->getOption('show-passwords')), - $this->silent(), // This removes column header and various helpful things in mysql. + $this->silent(), $this->getOption('extra', $this->queryExtra), $this->queryFile, Escape::shellArg($input_file),