mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-34704 Quick mode produces the bug for mariadb client
--quick-max-column-width parameter added to limit field width in --quick mode.
This commit is contained in:
parent
cb5bb4b319
commit
7a65dcb59e
3 changed files with 114 additions and 1 deletions
|
@ -255,6 +255,7 @@ static my_bool column_types_flag;
|
||||||
static my_bool preserve_comments= 0;
|
static my_bool preserve_comments= 0;
|
||||||
static my_bool in_com_source, aborted= 0;
|
static my_bool in_com_source, aborted= 0;
|
||||||
static ulong opt_max_allowed_packet, opt_net_buffer_length;
|
static ulong opt_max_allowed_packet, opt_net_buffer_length;
|
||||||
|
unsigned long quick_max_column_width= LONG_MAX;
|
||||||
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
|
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
|
||||||
static uint my_end_arg;
|
static uint my_end_arg;
|
||||||
static char * opt_mysql_unix_port=0;
|
static char * opt_mysql_unix_port=0;
|
||||||
|
@ -1821,6 +1822,10 @@ static struct my_option my_long_options[] =
|
||||||
"Don't cache result, print it row by row. This may slow down the server "
|
"Don't cache result, print it row by row. This may slow down the server "
|
||||||
"if the output is suspended. Doesn't use history file.",
|
"if the output is suspended. Doesn't use history file.",
|
||||||
&quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
&quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
{"quick-max-column-width", 0,
|
||||||
|
"Maximal field length limit in case of --qick", &quick_max_column_width,
|
||||||
|
&quick_max_column_width, 0, GET_ULONG, REQUIRED_ARG, LONG_MAX, 0, ULONG_MAX,
|
||||||
|
0, 1, 0},
|
||||||
{"raw", 'r', "Write fields without conversion. Used with --batch.",
|
{"raw", 'r', "Write fields without conversion. Used with --batch.",
|
||||||
&opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
&opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"reconnect", 0, "Reconnect if the connection is lost.",
|
{"reconnect", 0, "Reconnect if the connection is lost.",
|
||||||
|
@ -3877,7 +3882,7 @@ print_table_data(MYSQL_RES *result)
|
||||||
{
|
{
|
||||||
uint length= column_names ? field->name_length : 0;
|
uint length= column_names ? field->name_length : 0;
|
||||||
if (quick)
|
if (quick)
|
||||||
length= MY_MAX(length,field->length);
|
length= MY_MAX(length, MY_MIN(field->length, quick_max_column_width));
|
||||||
else
|
else
|
||||||
length= MY_MAX(length,field->max_length);
|
length= MY_MAX(length,field->max_length);
|
||||||
if (length < 4 && !IS_NOT_NULL(field->flags))
|
if (length < 4 && !IS_NOT_NULL(field->flags))
|
||||||
|
|
62
mysql-test/main/client.result
Normal file
62
mysql-test/main/client.result
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
#
|
||||||
|
# MDEV-34704: Quick mode produces the bug for mariadb client
|
||||||
|
#
|
||||||
|
create table t1 (aaaaaaaaa char (5), aaaaa char (10), a char (127), b char(1));
|
||||||
|
insert into t1 values ("X", "X", "X", "X");
|
||||||
|
# --table --quick
|
||||||
|
+-----------+------------+---------------------------------------------------------------------------------------------------------------------------------+------+
|
||||||
|
| aaaaaaaaa | aaaaa | a | b |
|
||||||
|
+-----------+------------+---------------------------------------------------------------------------------------------------------------------------------+------+
|
||||||
|
| X | X | X | X |
|
||||||
|
+-----------+------------+---------------------------------------------------------------------------------------------------------------------------------+------+
|
||||||
|
# --table --quick --quick-max-column-width=0
|
||||||
|
+-----------+-------+------+------+
|
||||||
|
| aaaaaaaaa | aaaaa | a | b |
|
||||||
|
+-----------+-------+------+------+
|
||||||
|
| X | X | X | X |
|
||||||
|
+-----------+-------+------+------+
|
||||||
|
# --table --quick --quick-max-column-width=10
|
||||||
|
+-----------+------------+------------+------+
|
||||||
|
| aaaaaaaaa | aaaaa | a | b |
|
||||||
|
+-----------+------------+------------+------+
|
||||||
|
| X | X | X | X |
|
||||||
|
+-----------+------------+------------+------+
|
||||||
|
# --table --quick --quick-max-column-width=20
|
||||||
|
+-----------+------------+----------------------+------+
|
||||||
|
| aaaaaaaaa | aaaaa | a | b |
|
||||||
|
+-----------+------------+----------------------+------+
|
||||||
|
| X | X | X | X |
|
||||||
|
+-----------+------------+----------------------+------+
|
||||||
|
insert into t1 values ("01234", "0123456789", "01234567890123456789", "1");
|
||||||
|
# --table --quick
|
||||||
|
+-----------+------------+---------------------------------------------------------------------------------------------------------------------------------+------+
|
||||||
|
| aaaaaaaaa | aaaaa | a | b |
|
||||||
|
+-----------+------------+---------------------------------------------------------------------------------------------------------------------------------+------+
|
||||||
|
| X | X | X | X |
|
||||||
|
| 01234 | 0123456789 | 01234567890123456789 | 1 |
|
||||||
|
+-----------+------------+---------------------------------------------------------------------------------------------------------------------------------+------+
|
||||||
|
# --table --quick --quick-max-column-width=0
|
||||||
|
+-----------+-------+------+------+
|
||||||
|
| aaaaaaaaa | aaaaa | a | b |
|
||||||
|
+-----------+-------+------+------+
|
||||||
|
| X | X | X | X |
|
||||||
|
| 01234 | 0123456789 | 01234567890123456789 | 1 |
|
||||||
|
+-----------+-------+------+------+
|
||||||
|
# --table --quick --quick-max-column-width=10
|
||||||
|
+-----------+------------+------------+------+
|
||||||
|
| aaaaaaaaa | aaaaa | a | b |
|
||||||
|
+-----------+------------+------------+------+
|
||||||
|
| X | X | X | X |
|
||||||
|
| 01234 | 0123456789 | 01234567890123456789 | 1 |
|
||||||
|
+-----------+------------+------------+------+
|
||||||
|
# --table --quick --quick-max-column-width=20
|
||||||
|
+-----------+------------+----------------------+------+
|
||||||
|
| aaaaaaaaa | aaaaa | a | b |
|
||||||
|
+-----------+------------+----------------------+------+
|
||||||
|
| X | X | X | X |
|
||||||
|
| 01234 | 0123456789 | 01234567890123456789 | 1 |
|
||||||
|
+-----------+------------+----------------------+------+
|
||||||
|
drop table t1;
|
||||||
|
#
|
||||||
|
# End of 10.7 tests
|
||||||
|
#
|
46
mysql-test/main/client.test
Normal file
46
mysql-test/main/client.test
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
--source include/not_embedded.inc
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-34704: Quick mode produces the bug for mariadb client
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
|
||||||
|
create table t1 (aaaaaaaaa char (5), aaaaa char (10), a char (127), b char(1));
|
||||||
|
insert into t1 values ("X", "X", "X", "X");
|
||||||
|
|
||||||
|
|
||||||
|
--echo # --table --quick
|
||||||
|
--exec echo "select * from test.t1;" | $MYSQL --table --quick 2>&1
|
||||||
|
|
||||||
|
|
||||||
|
--echo # --table --quick --quick-max-column-width=0
|
||||||
|
--exec echo "select * from test.t1;" | $MYSQL --table --quick --quick-max-column-width=0 2>&1
|
||||||
|
|
||||||
|
|
||||||
|
--echo # --table --quick --quick-max-column-width=10
|
||||||
|
--exec echo "select * from test.t1;" | $MYSQL --table --quick --quick-max-column-width=10 2>&1
|
||||||
|
|
||||||
|
|
||||||
|
--echo # --table --quick --quick-max-column-width=20
|
||||||
|
--exec echo "select * from test.t1;" | $MYSQL --table --quick --quick-max-column-width=20 2>&1
|
||||||
|
|
||||||
|
insert into t1 values ("01234", "0123456789", "01234567890123456789", "1");
|
||||||
|
|
||||||
|
--echo # --table --quick
|
||||||
|
--exec echo "select * from test.t1;" | $MYSQL --table --quick 2>&1
|
||||||
|
|
||||||
|
|
||||||
|
--echo # --table --quick --quick-max-column-width=0
|
||||||
|
--exec echo "select * from test.t1;" | $MYSQL --table --quick --quick-max-column-width=0 2>&1
|
||||||
|
|
||||||
|
--echo # --table --quick --quick-max-column-width=10
|
||||||
|
--exec echo "select * from test.t1;" | $MYSQL --table --quick --quick-max-column-width=10 2>&1
|
||||||
|
|
||||||
|
--echo # --table --quick --quick-max-column-width=20
|
||||||
|
--exec echo "select * from test.t1;" | $MYSQL --table --quick --quick-max-column-width=20 2>&1
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # End of 10.7 tests
|
||||||
|
--echo #
|
Loading…
Reference in a new issue