Commit df3e68f4 authored by unknown's avatar unknown

Merge mysql.com:/home/jimw/my/mysql-4.1-8866

into mysql.com:/home/jimw/my/mysql-4.1-clean


client/mysqltest.c:
  Auto merged
sql-common/client.c:
  Auto merged
parents 77817bce cdad9c98
......@@ -280,6 +280,7 @@ Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS,
Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL,
Q_START_TIMER, Q_END_TIMER,
Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
......@@ -365,6 +366,8 @@ const char *command_names[]=
"character_set",
"disable_ps_protocol",
"enable_ps_protocol",
"disable_reconnect",
"enable_reconnect",
0
};
......@@ -3624,6 +3627,12 @@ int main(int argc, char **argv)
case Q_ENABLE_PS_PROTOCOL:
ps_protocol_enabled= ps_protocol;
break;
case Q_DISABLE_RECONNECT:
cur_con->mysql.reconnect= 0;
break;
case Q_ENABLE_RECONNECT:
cur_con->mysql.reconnect= 1;
break;
default: processed = 0; break;
}
......
......@@ -5,6 +5,14 @@ select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id)
0
kill @id;
select 1;
ERROR HY000: MySQL server has gone away
select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id)
0
select @id != connection_id();
@id != connection_id()
1
select 4;
4
4
......
......@@ -23,12 +23,15 @@ connection con2;
select ((@id := kill_id) - kill_id) from t1;
kill @id;
# Wait for thread to do.
--sleep 5
# verify that con1 is doning a reconnect
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 != connection_id();
#make sure the server is still alive
......
......@@ -2190,6 +2190,29 @@ my_bool mysql_reconnect(MYSQL *mysql)
DBUG_RETURN(1);
}
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 */
bzero((char*) &mysql->options,sizeof(mysql->options));
mysql->free_me=0;
......@@ -2278,6 +2301,10 @@ static void mysql_close_free(MYSQL *mysql)
SYNOPSYS
mysql_detach_stmt_list()
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)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment