mysql_list_processes()
MYSQL_RES *mysql_list_processes(MYSQL *mysql)
This function returns a results set containing a list of MySQL server processes or server threads found for the handle given as the argument of the function.
Here is an example:
...
result = mysql_list_processes(mysql);
while((row = mysql_fetch_row(result)) != NULL)
{
printf("Thread ID: %s \n", row[0]);
printf("User: %s, Host: %s \n", row[1], row[2]);
printf("Database: %s, Command: %s \n", row[3], row[4]);
printf("Time: %s, State: %s, Info: %s \n\n",
row[5],row[6],row[7]);
}
mysql_free_result(result);
...Using the mysql_fetch_row() function,
each row of the results set is read and each field is displayed with
its related label. The results are the same as the
SHOW PROCESSES query in MySQL.
It’s important to run the mysql_free_result()
function when finished with a results set, as shown here.