Skip to content

Commit a5b8b36

Browse files
committed
Remove calls to mysql_reload() and mysql_list_fields()
1 parent 2a7beb7 commit a5b8b36

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

dbdimp.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2793,7 +2793,23 @@ my_ulonglong mysql_st_internal_execute(
27932793
}
27942794
*sbuf++= '\0';
27952795

2796-
*result= mysql_list_fields(svsock, table, NULL);
2796+
char* buffer = malloc(strlen(table)+20);
2797+
if (buffer == NULL)
2798+
{
2799+
do_error(h, JW_ERR_MEM, "Out of memory" ,NULL);
2800+
return -2;
2801+
}
2802+
else
2803+
{
2804+
strcpy(buffer, "SHOW COLUMNS FROM ");
2805+
strcat(buffer, table);
2806+
if (mysql_real_query(svsock, buffer, strlen(buffer)) != 0) {
2807+
do_error(h, JW_ERR_QUERY, "Query for columns failed" ,NULL);
2808+
return -2;
2809+
}
2810+
*result = mysql_store_result(svsock);
2811+
free(buffer);
2812+
}
27972813

27982814
free(table);
27992815

lib/DBD/mysql.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ sub admin {
188188
my($user) = shift || '';
189189
my($password) = shift || '';
190190

191+
warn 'admin() is deprecated and will be removed in an upcoming version';
192+
191193
$drh->func(undef, $command,
192194
$dbname || '',
193195
$host || '',

mysql.xs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ _admin_internal(drh,dbh,command,dbname=NULL,host=NULL,port=NULL,user=NULL,passwo
100100
int retval;
101101
MYSQL* sock;
102102
const char *shutdown = "SHUTDOWN";
103+
const char *reload = "FLUSH PRIVILEGES";
103104

104105
/*
105106
* Connect to the database, if required.
@@ -123,7 +124,7 @@ _admin_internal(drh,dbh,command,dbname=NULL,host=NULL,port=NULL,user=NULL,passwo
123124
if (strEQ(command, "shutdown"))
124125
retval = mysql_real_query(sock, shutdown, strlen(shutdown));
125126
else if (strEQ(command, "reload"))
126-
retval = mysql_reload(sock);
127+
retval = mysql_real_query(sock, reload, strlen(reload));
127128
else if (strEQ(command, "createdb"))
128129
{
129130
char* buffer = malloc(strlen(dbname)+50);

0 commit comments

Comments
 (0)