Description:
The mysql command line client displays dashes (----) at the beginning and end of the result set:
mysql> SELECT NULL;
+------+
| NULL |
+------+
| NULL |
+------+
1 row in set (0.00 sec)
However, for fields with a very "wide" length, this is annoying and makes interpretation difficult (see How to repeat). A good feature would be to have a max_display_column_wide variable for the mysql command line client. Here is a patch with the maximum width hard coded:
shell> diff -u mysql-5.1.50/client/mysql.cc mysql-5.1.50.orig/mysql-5.1.50/client/mysql.cc
--- mysql-5.1.50/client/mysql.cc 2010-08-03 18:24:30.000000000 +0100
+++ mysql-5.1.50.orig/mysql-5.1.50/client/mysql.cc 2010-09-07 16:48:10.000000000 +0100
@@ -3332,6 +3332,7 @@
if (length < 4 && !IS_NOT_NULL(field->flags))
length=4; // Room for "NULL"
field->max_length=length;
+ length = min(length, 100); // Hardcoded test for long strings display separator.fill(separator.length()+length+2,'-');
separator.append('+');
}
It shouldn't be too hard to s/100/max_display_column_wide :)
How to repeat:
drop table if exists y_T;
create table y_T ( id int unsigned auto_increment, t text, primary key
(id));
/* 10 */
insert into y_T (t) value ("0123456789");
select * from y_T order by id desc limit 1;
/* 21 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 43 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 87 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 175 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 351 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 703 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 1407 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 2815 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 5631 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 11263 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 22527 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 45055 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 90111 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 180223 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 360447 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 720895 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
/* 1441791 */
insert into y_T (t) select concat_ws("\n",t,t) from y_T order by id desc
limit 1;
select * from y_T order by id desc limit 1;
Suggested fix:
Implement an option in mysql command line client to limit the maximum size of the dashed header/footer.
I know the --silent option exists but that completely removes any tabular separators.