From f24b529b4c35c0469f457d973a99172aa0d5499d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 12 Mar 2024 09:04:04 +0100 Subject: [PATCH] Remove calls to mysql_reload() and mysql_list_fields() --- dbdimp.c | 18 +++++++++++++++++- lib/DBD/mysql.pm | 2 ++ mysql.xs | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/dbdimp.c b/dbdimp.c index bfbe216b..0f947d62 100644 --- a/dbdimp.c +++ b/dbdimp.c @@ -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); diff --git a/lib/DBD/mysql.pm b/lib/DBD/mysql.pm index 24561790..5612ec5b 100644 --- a/lib/DBD/mysql.pm +++ b/lib/DBD/mysql.pm @@ -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 || '', diff --git a/mysql.xs b/mysql.xs index 39ed7735..a1374e52 100644 --- a/mysql.xs +++ b/mysql.xs @@ -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. @@ -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);