[MDEV-12169] port "Print binary data as hex in the mysql client" by @dveeden Created: 2017-03-03 Updated: 2017-07-17 Resolved: 2017-07-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Fix Version/s: | 5.5.57 |
| Type: | Task | Priority: | Major |
| Reporter: | Sergey Vojtovich | Assignee: | Sergey Vojtovich |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | contribution, foundation | ||
| Issue Links: |
|
||||||||
| Description |
|
|
| Comments |
| Comment by Sergei Golubchik [ 2017-03-03 ] | ||||||||||||||||
|
I'd like something that makes it clear when a value is auto-converted to hex and when a value is simply printed as such (and looks like a hex number, because it's stored in a string as hex representation of something). For example
See, spaces are missing — it's impossible to have that for a normal value, so it must mean some special code inside mysql client (indeed, special auto-hex code). I don't mean this is what the output should look like, it's probably not even a good output suggestion, it's just to illustrate the point. Another one:
Ugh, it's even worse. But you get the point. | ||||||||||||||||
| Comment by Eric Herman [ 2017-03-06 ] | ||||||||||||||||
|
I don't see the need. How is what you're highlighting different than strings which happen to contain numbers?
If it is a binary column, the values are binary, and I seldom want client experience which happens to print okay in some cases, and not others. With this patch, if I want that "loose" behavior I can get it in a couple ways, "unhex(col)" for case-by-case usage or globally by setting --binary-as-hex=0 (on the comand line, or in the conf). | ||||||||||||||||
| Comment by Sergei Golubchik [ 2017-03-06 ] | ||||||||||||||||
|
You cannot do unhex() for case by case usage, because unhex is a server function, and auto-hex works on the client. Anyway, if you feel there's no need to do it and no ambiguity, let's not do it. | ||||||||||||||||
| Comment by Eric Herman [ 2017-03-06 ] | ||||||||||||||||
|
D'oh! Excellent point! Indeed unhex() would not work like that. That said, indeed I continue to think that the commandline switch is enough for those rare cases where I am piping between processes. (Speaking for myself, I truly /never/ want the output to trash my terminal's state because I did something as seemingly harmless as "select * from foo limit 1".) | ||||||||||||||||
| Comment by Sergei Golubchik [ 2017-07-17 ] | ||||||||||||||||
|
merged in |