Skip to content

Commit

Permalink
Fix for CONC-457:
Browse files Browse the repository at this point in the history
mysql_list_processlists was marked as deprecated in MySQL 4.0 and not
updated anymore. It exists still in latest MySQL and MariaDB connectors.
It now supports the 4.1 protocol, using 7 instead of 5 fields.

The following functions are now marked deprecated in source:
* mysql_list_dbs
* mysql_list_tables
* mysql_list_processes
  • Loading branch information
9EOR9 committed Feb 28, 2020
1 parent 5d86a33 commit 6a0c8ff
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
19 changes: 18 additions & 1 deletion libmariadb/mariadb_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2476,6 +2476,12 @@ mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET field_offset)
return return_value;
}

/********************************************************
Warning: mysql_list_dbs is deprecated and will be
removed. Use SQL statement "SHOW DATABASES"
instead
********************************************************/

/*****************************************************************************
** List all databases
*****************************************************************************/
Expand All @@ -2491,6 +2497,11 @@ mysql_list_dbs(MYSQL *mysql, const char *wild)
}


/********************************************************
Warning: mysql_list_tables is deprecated and will be
removed. Use SQL statement "SHOW TABLES"
instead
********************************************************/
/*****************************************************************************
** List all tables in a database
** If wild is given then only the tables matching wild are returned
Expand Down Expand Up @@ -2550,6 +2561,12 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
return(NULL);
}

/********************************************************
Warning: mysql_list_processes is deprecated and will be
removed. Use SQL statement "SHOW PROCESSLIST"
instead
********************************************************/

/* List all running processes (threads) in server */

MYSQL_RES * STDCALL
Expand All @@ -2565,7 +2582,7 @@ mysql_list_processes(MYSQL *mysql)
free_old_query(mysql);
pos=(uchar*) mysql->net.read_pos;
field_count=(uint) net_field_length(&pos);
if (!(fields = mysql->methods->db_read_rows(mysql,(MYSQL_FIELD*) 0,5)))
if (!(fields = mysql->methods->db_read_rows(mysql,(MYSQL_FIELD*) 0,7)))
return(NULL);
if (!(mysql->fields=unpack_fields(fields, &mysql->field_alloc,
field_count, 0)))
Expand Down
10 changes: 10 additions & 0 deletions unittest/libmariadb/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,8 +1426,18 @@ static int test_sslenforce(MYSQL *unused __attribute__((unused)))
}
#endif

static int test_conc457(MYSQL *mysql)
{
MYSQL_RES *result= mysql_list_processes(mysql);

FAIL_IF(mysql_field_count(mysql) != 9, "expected 9 columns");
mysql_free_result(result);
return OK;
}


struct my_tests_st my_tests[] = {
{"test_conc457", test_conc457, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc384", test_conc384, TEST_CONNECTION_NONE, 0, NULL, NULL},
#ifndef _WIN32
{"test_mdev12965", test_mdev12965, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
Expand Down

0 comments on commit 6a0c8ff

Please sign in to comment.