Hi Staale,
On 5/15/09 7:14 AM, Staale Smedseng wrote:
> #At file:///export/home/tmp/ss156133/z/43560-51g/ based on
> revid:pstoev@stripped
>
> 2884 Staale Smedseng 2009-05-15
> Bug #43560 client crashes in mysql_stmt_execute/
> mysql_stmt_close after connection loss
Missing a brief description of the problem.
> The invalidation of client-side prepared statments
statments -> statements
> in the event of connection loss is now factored out
> into a new function mysql_prune_stmt_list(). This
> is now used in conjunction with the end_server()
> function, rather than after-the-fact in
> mysql_reconnect() as was previously the case.
> @ libmysql/client_settings.h
> Declaration of new function mysql_prune_stmt_list().
> @ sql-common/client.c
> Definition and use of new function mysql_prune_stmt_list().
> Removal of previously used code in mysql_reconnect().
>
> modified:
> libmysql/client_settings.h
> sql-common/client.c
> === modified file 'libmysql/client_settings.h'
> --- a/libmysql/client_settings.h 2007-09-29 19:31:08 +0000
> +++ b/libmysql/client_settings.h 2009-05-15 10:14:12 +0000
> @@ -41,6 +41,7 @@ my_bool handle_local_infile(MYSQL *mysql
>
> void mysql_read_default_options(struct st_mysql_options *options,
> const char *filename,const char *group);
> +void mysql_prune_stmt_list(MYSQL *mysql);
> void mysql_detach_stmt_list(LIST **stmt_list, const char *func_name);
> MYSQL * STDCALL
> cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
>
> === modified file 'sql-common/client.c'
> --- a/sql-common/client.c 2009-03-19 13:42:36 +0000
> +++ b/sql-common/client.c 2009-05-15 10:14:12 +0000
> @@ -924,6 +924,7 @@ void end_server(MYSQL *mysql)
> vio_delete(mysql->net.vio);
> reset_sigpipe(mysql);
> mysql->net.vio= 0; /* Marker */
> + mysql_prune_stmt_list(mysql);
> }
> net_end(&mysql->net);
> free_old_query(mysql);
> @@ -2526,31 +2527,6 @@ my_bool mysql_reconnect(MYSQL *mysql)
> tmp_mysql.reconnect= 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;
> - stmt->last_errno= CR_SERVER_LOST;
> - strmov(stmt->last_error, ER(CR_SERVER_LOST));
> - strmov(stmt->sqlstate, unknown_sqlstate);
> - }
> - else
> - {
> - tmp_mysql.stmts= list_add(tmp_mysql.stmts,&stmt->list);
> - }
> - /* No need to call list_delete for statement here */
> - }
> - mysql->stmts= NULL;
> - }
> -
It seems we won't be moving MYSQL_STMT_INIT_DONE statements to the new
handle... is it intentional?
Regards,
-- Davi Arnaut