1021
1021
template class I_List<thread_info>;
1024
void mysqld_list_processes(Session *session,const char *user, bool verbose)
1024
void mysqld_list_processes(Session *session,const char *user, bool)
1027
1027
List<Item> field_list;
1028
1028
I_List<thread_info> thread_infos;
1029
ulong max_query_length= (verbose ? session->variables.max_allowed_packet :
1030
PROCESS_LIST_WIDTH);
1031
1029
Protocol *protocol= session->protocol;
1033
1031
field_list.push_back(new Item_int("Id", 0, MY_INT32_NUM_DECIMAL_DIGITS));
1034
1032
field_list.push_back(new Item_empty_string("User",16));
1035
1033
field_list.push_back(new Item_empty_string("Host",LIST_PROCESS_HOST_LEN));
1036
1034
field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN));
1037
field->maybe_null=1;
1035
field->maybe_null= true;
1038
1036
field_list.push_back(new Item_empty_string("Command",16));
1039
1037
field_list.push_back(new Item_return_int("Time",7, DRIZZLE_TYPE_LONG));
1040
1038
field_list.push_back(field=new Item_empty_string("State",30));
1041
field->maybe_null=1;
1042
field_list.push_back(field=new Item_empty_string("Info",max_query_length));
1043
field->maybe_null=1;
1039
field->maybe_null= true;
1040
field_list.push_back(field=new Item_empty_string("Info", PROCESS_LIST_WIDTH));
1041
field->maybe_null= true;
1044
1042
if (protocol->send_fields(&field_list,
1045
1043
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
1085
1083
session_info->query=0;
1086
1084
if (tmp->query)
1089
1087
query_length is always set to 0 when we set query = NULL; see
1090
1088
the comment in session.h why this prevents crashes in possible
1091
1089
races with query_length
1093
uint32_t length= cmin((uint32_t)max_query_length, tmp->query_length);
1094
session_info->query=(char*) session->strmake(tmp->query,length);
1091
session_info->query=(char*) session->strdup(tmp->process_list_info);
1096
1093
thread_infos.append(session_info);