-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: conditionally output unicode characters in the output of sql -e
Summary: - by default, `sql -e` always escapes strings that contain special characters. It also forcefully escapes strings containing double quotes and backslashes, so as to ease automated processing by other languages (ie. a string starting with a doublequote character in the output will always be the start of an escaped string.). This way issue #4315 is still addressed adequately. - a new flag `--pretty` is added to the `sql` sub-command, to print row data as pretty-formatted ASCII art tables. - when results are pretty-formatted (either in the interactive shell or with `sql --pretty -e`), graphic unicode and newline characters are printed without escaping. This keeps the fix to #6926. - new tests are added in `cli_test.go` (`Example_sql_escape`) to test escaped and non-escaped output when table and column names contain special characters. - the `cli` API renames `runPrettyQuery` to `runQueryAndFormatResults`, and extends it with an extra argument to specify pretty-printing. (See issues/PRs #7045, #6926, #4354 and #4315 for background discussion.)
- Loading branch information
Showing
10 changed files
with
222 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.