How can I see spaces in String when using select using the sql command line client?
I mean the following. you have three lines. 1, 2 and 3 spaces. The number of spaces is missing.
create table foo(bar varchar(8));
insert into foo values(" "),(" "), (" ");
select * from foo\g
+------+
| bar |
+------+
| |
| |
| |
+------+
mysql> select * from foo\G
*************************** 1. row ***************************
bar:
*************************** 2. row ***************************
bar:
*************************** 3. row ***************************
bar:
3 rows in set (0.01 sec)
The only option I came across is:
mysql> select bar, hex(bar) from foo;
+------+----------+
| bar | hex(bar) |
+------+----------+
| | 20 |
| | 2020 |
| | 202020 |
+------+----------+
3 rows in set (0.01 sec)
Something like var_export in php would be nice.
source
share