@@ -2943,25 +2943,27 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
2943
2943
2944
2944
while (thread_info *thd_info= arg.thread_infos .get ())
2945
2945
{
2946
+ const char *str;
2947
+ ulonglong start_time;
2948
+ CSET_STRING query;
2949
+
2946
2950
protocol->prepare_for_resend ();
2947
2951
protocol->store (thd_info->thread_id );
2948
2952
protocol->store (thd_info->user , strlen (thd_info->user ), system_charset_info);
2949
2953
protocol->store (thd_info->host , strlen (thd_info->host ), system_charset_info);
2950
2954
protocol->store_string_or_null (thd_info->db , system_charset_info);
2951
- if (thd_info->proc_info )
2952
- protocol->store (thd_info->proc_info , strlen (thd_info->proc_info ),
2953
- system_charset_info);
2955
+ if ((str= thd_info->proc_info ))
2956
+ protocol->store (str, strlen (str), system_charset_info);
2954
2957
else
2955
2958
protocol->store (&command_name[thd_info->command ], system_charset_info);
2956
- if (thd_info->start_time && now > thd_info-> start_time )
2957
- protocol->store_long ((now - thd_info-> start_time ) / HRTIME_RESOLUTION);
2959
+ if ((start_time= thd_info->start_time ) && now > start_time)
2960
+ protocol->store_long ((now - start_time) / HRTIME_RESOLUTION);
2958
2961
else
2959
2962
protocol->store_null ();
2960
2963
protocol->store_string_or_null (thd_info->state_info , system_charset_info);
2961
- if (thd_info->query_string .length ())
2962
- protocol->store (thd_info->query_string .str (),
2963
- thd_info->query_string .length (),
2964
- thd_info->query_string .charset ());
2964
+ query= thd_info->query_string ;
2965
+ if (query.length () && query.str ())
2966
+ protocol->store (query.str (), query.length (), query.charset ());
2965
2967
else
2966
2968
protocol->store_null ();
2967
2969
if (!(thd->variables .old_behavior & OLD_MODE_NO_PROGRESS_INFO))
0 commit comments