Skip to content

Commit

Permalink
Remove calls to mysql_reload() and mysql_list_fields()
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden committed Mar 12, 2024
1 parent 2a7beb7 commit f24b529
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
18 changes: 17 additions & 1 deletion dbdimp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2793,7 +2793,23 @@ my_ulonglong mysql_st_internal_execute(
}
*sbuf++= '\0';

*result= mysql_list_fields(svsock, table, NULL);
char* buffer = malloc(strlen(table)+20);
if (buffer == NULL)
{
do_error(h, JW_ERR_MEM, "Out of memory" ,NULL);
return -2;
}
else
{
strcpy(buffer, "SHOW COLUMNS FROM ");
strcat(buffer, table);
if (mysql_real_query(svsock, buffer, strlen(buffer)) != 0) {
do_error(h, JW_ERR_QUERY, "Query for columns failed" ,NULL);
return -2;
}
*result = mysql_store_result(svsock);
free(buffer);
}

free(table);

Expand Down
2 changes: 2 additions & 0 deletions lib/DBD/mysql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ sub admin {
my($user) = shift || '';
my($password) = shift || '';

warn 'admin() is deprecated and will be removed in an upcoming version';

$drh->func(undef, $command,
$dbname || '',
$host || '',
Expand Down
3 changes: 2 additions & 1 deletion mysql.xs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ _admin_internal(drh,dbh,command,dbname=NULL,host=NULL,port=NULL,user=NULL,passwo
int retval;
MYSQL* sock;
const char *shutdown = "SHUTDOWN";
const char *reload = "FLUSH PRIVILEGES";

/*
* Connect to the database, if required.
Expand All @@ -123,7 +124,7 @@ _admin_internal(drh,dbh,command,dbname=NULL,host=NULL,port=NULL,user=NULL,passwo
if (strEQ(command, "shutdown"))
retval = mysql_real_query(sock, shutdown, strlen(shutdown));
else if (strEQ(command, "reload"))
retval = mysql_reload(sock);
retval = mysql_real_query(sock, reload, strlen(reload));
else if (strEQ(command, "createdb"))
{
char* buffer = malloc(strlen(dbname)+50);
Expand Down

0 comments on commit f24b529

Please sign in to comment.