diff options
author | jimw@mysql.com <> | 2005-03-28 09:59:41 -0800 |
---|---|---|
committer | jimw@mysql.com <> | 2005-03-28 09:59:41 -0800 |
commit | 9c86b351945af4e3cde4e48a33394a268c16429a (patch) | |
tree | 78e84e0886e0c93e92557c2a21167ac6e8d2ebd2 /sql-common/client.c | |
parent | 4f19826d8038efecd2251c1a60632e3e6cf39295 (diff) | |
download | mariadb-git-9c86b351945af4e3cde4e48a33394a268c16429a.tar.gz |
Fix reconnect when using prepared statements, and add
--disable_reconnect and --enable_reconnect to mysqltest
so that it can be tested properly. (Bug #8866)
Diffstat (limited to 'sql-common/client.c')
-rw-r--r-- | sql-common/client.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index 3de2483ef75..b1455f0976a 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -2189,6 +2189,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; @@ -2277,6 +2300,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))) |