This commit is contained in:
jimw@mysql.com 2005-04-04 23:03:56 -07:00
commit bb215f648b
8 changed files with 93 additions and 17 deletions

View File

@ -294,6 +294,7 @@ Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL,
Q_START_TIMER, Q_END_TIMER, Q_START_TIMER, Q_END_TIMER,
Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL, Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
Q_EXIT, Q_EXIT,
Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
Q_UNKNOWN, /* Unknown command. */ Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */ Q_COMMENT, /* Comments, ignored. */
@ -382,6 +383,8 @@ const char *command_names[]=
"disable_ps_protocol", "disable_ps_protocol",
"enable_ps_protocol", "enable_ps_protocol",
"exit", "exit",
"disable_reconnect",
"enable_reconnect",
0 0
}; };
@ -3895,6 +3898,12 @@ int main(int argc, char **argv)
case Q_ENABLE_PS_PROTOCOL: case Q_ENABLE_PS_PROTOCOL:
ps_protocol_enabled= ps_protocol; ps_protocol_enabled= ps_protocol;
break; break;
case Q_DISABLE_RECONNECT:
cur_con->mysql.reconnect= 0;
break;
case Q_ENABLE_RECONNECT:
cur_con->mysql.reconnect= 1;
break;
case Q_EXIT: case Q_EXIT:
abort_flag= 1; abort_flag= 1;

View File

@ -924,3 +924,22 @@ a b a b
3 1 NULL NULL 3 1 NULL NULL
4 2 NULL NULL 4 2 NULL NULL
DROP TABLE t1,t2; DROP TABLE t1,t2;
set group_concat_max_len=5;
create table t1 (a int, b varchar(20));
create table t2 (a int, c varchar(20));
insert into t1 values (1,"aaaaaaaaaa"),(2,"bbbbbbbbbb");
insert into t2 values (1,"cccccccccc"),(2,"dddddddddd");
select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by t1.a;
group_concat(t1.b,t2.c)
aaaaa
bbbbb
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a;
group_concat(t1.b,t2.c)
aaaaa
bbbbb
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
drop table t1, t2;
set group_concat_max_len=default;

View File

@ -5,6 +5,8 @@ select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id) ((@id := kill_id) - kill_id)
0 0
kill @id; kill @id;
select 1;
ERROR HY000: MySQL server has gone away
select ((@id := kill_id) - kill_id) from t1; select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id) ((@id := kill_id) - kill_id)
0 0

View File

@ -651,4 +651,13 @@ SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE not(0+(t1.a=30 and t2.b=1));
DROP TABLE t1,t2; DROP TABLE t1,t2;
# Bug #8681: Bad warning message when group_concat() exceeds max length
set group_concat_max_len=5;
create table t1 (a int, b varchar(20));
create table t2 (a int, c varchar(20));
insert into t1 values (1,"aaaaaaaaaa"),(2,"bbbbbbbbbb");
insert into t2 values (1,"cccccccccc"),(2,"dddddddddd");
select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by t1.a;
select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a;
drop table t1, t2;
set group_concat_max_len=default;

View File

@ -23,12 +23,14 @@ connection con2;
select ((@id := kill_id) - kill_id) from t1; select ((@id := kill_id) - kill_id) from t1;
kill @id; kill @id;
# Wait for thread to do.
--sleep 5
# verify that con1 is doning a reconnect
connection con1; connection con1;
--ping
--ping --disable_reconnect
# this statement should fail
--error 2006
select 1;
--enable_reconnect
# this should work, and we should have a new connection_id()
select ((@id := kill_id) - kill_id) from t1; select ((@id := kill_id) - kill_id) from t1;
select @id != connection_id(); select @id != connection_id();

View File

@ -2211,6 +2211,29 @@ my_bool mysql_reconnect(MYSQL *mysql)
} }
tmp_mysql.reconnect= 1; tmp_mysql.reconnect= 1;
tmp_mysql.free_me= mysql->free_me; tmp_mysql.free_me= mysql->free_me;
/*
For each stmt in mysql->stmts, move it to tmp_mysql if it is
in state MYSQL_STMT_INIT_DONE, otherwise close it.
*/
{
LIST *element= mysql->stmts;
for (; element; element= element->next)
{
MYSQL_STMT *stmt= (MYSQL_STMT *) element->data;
if (stmt->state != MYSQL_STMT_INIT_DONE)
{
stmt->mysql= 0;
}
else
{
tmp_mysql.stmts= list_add(tmp_mysql.stmts, &stmt->list);
}
/* No need to call list_delete for statement here */
}
mysql->stmts= NULL;
}
/* Don't free options as these are now used in tmp_mysql */ /* Don't free options as these are now used in tmp_mysql */
bzero((char*) &mysql->options,sizeof(mysql->options)); bzero((char*) &mysql->options,sizeof(mysql->options));
mysql->free_me=0; mysql->free_me=0;
@ -2299,6 +2322,10 @@ static void mysql_close_free(MYSQL *mysql)
SYNOPSYS SYNOPSYS
mysql_detach_stmt_list() mysql_detach_stmt_list()
stmt_list pointer to mysql->stmts stmt_list pointer to mysql->stmts
NOTE
There is similar code in mysql_reconnect(), so changes here
should also be reflected there.
*/ */
void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused))) void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused)))

View File

@ -2802,9 +2802,20 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
void Item_func_group_concat::cleanup() void Item_func_group_concat::cleanup()
{ {
THD *thd= current_thd;
DBUG_ENTER("Item_func_group_concat::cleanup"); DBUG_ENTER("Item_func_group_concat::cleanup");
Item_sum::cleanup(); Item_sum::cleanup();
/* Adjust warning message to include total number of cut values */
if (warning)
{
char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff, ER(ER_CUT_VALUE_GROUP_CONCAT), count_cut_values);
warning->set_msg(thd, warn_buff);
warning= 0;
}
/* /*
Free table and tree if they belong to this item (if item have not pointer Free table and tree if they belong to this item (if item have not pointer
to original item from which was made copy => it own its objects ) to original item from which was made copy => it own its objects )
@ -3059,6 +3070,10 @@ String* Item_func_group_concat::val_str(String* str)
return 0; return 0;
if (count_cut_values && !warning) if (count_cut_values && !warning)
{ {
/*
ER_CUT_VALUE_GROUP_CONCAT needs an argument, but this gets set in
Item_func_group_concat::cleanup().
*/
DBUG_ASSERT(table); DBUG_ASSERT(table);
warning= push_warning(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN, warning= push_warning(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_CUT_VALUE_GROUP_CONCAT, ER_CUT_VALUE_GROUP_CONCAT,

View File

@ -6116,16 +6116,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
sf_malloc_mem_limit = atoi(argument); sf_malloc_mem_limit = atoi(argument);
#endif #endif
break; break;
#ifdef EMBEDDED_LIBRARY
case OPT_MAX_ALLOWED_PACKET:
max_allowed_packet= atoi(argument);
global_system_variables.max_allowed_packet= max_allowed_packet;
break;
case OPT_NET_BUFFER_LENGTH:
net_buffer_length= atoi(argument);
global_system_variables.net_buffer_length= net_buffer_length;
break;
#endif
#include <sslopt-case.h> #include <sslopt-case.h>
case 'V': case 'V':
print_version(); print_version();
@ -6713,6 +6703,9 @@ static void get_options(int argc,char **argv)
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if (mysqld_chroot) if (mysqld_chroot)
set_root(mysqld_chroot); set_root(mysqld_chroot);
#else
max_allowed_packet= global_system_variables.max_allowed_packet;
net_buffer_length= global_system_variables.net_buffer_length;
#endif #endif
fix_paths(); fix_paths();