1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Fix for CONC-525: Support LOAD * LOCAL INFILE statements in binary protocol

With implementation of MDEV-16708 (support all commands in binary protocol) we
need to check for local infile in text and binary protocol. Therefore the local
infile relevant part from ma_simple_command was moved to mthd_my_send_cmd method.
This commit is contained in:
Georg Richter
2021-02-23 07:55:35 +01:00
parent 375bab0d51
commit ca1ea5c1a2
2 changed files with 77 additions and 8 deletions

View File

@@ -388,6 +388,18 @@ mthd_my_send_cmd(MYSQL *mysql,enum enum_server_command command, const char *arg,
CLEAR_CLIENT_ERROR(mysql);
if (command == COM_QUERY ||
command == COM_STMT_PREPARE)
{
if ((mysql->options.client_flag & CLIENT_LOCAL_FILES) &&
mysql->options.extension && mysql->extension->auto_local_infile == WAIT_FOR_QUERY &&
arg && (*arg == 'l' || *arg == 'L'))
{
if (strncasecmp(arg, "load", 4) == 0)
mysql->extension->auto_local_infile= ACCEPT_FILE_REQUEST;
}
}
mysql->info=0;
mysql->affected_rows= ~(unsigned long long) 0;
ma_net_clear(net); /* Clear receive buffer */
@@ -435,14 +447,6 @@ int
ma_simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
size_t length, my_bool skipp_check, void *opt_arg)
{
if ((mysql->options.client_flag & CLIENT_LOCAL_FILES) &&
mysql->options.extension && mysql->extension->auto_local_infile == WAIT_FOR_QUERY &&
arg && (*arg == 'l' || *arg == 'L') &&
command == COM_QUERY)
{
if (strncasecmp(arg, "load", 4) == 0)
mysql->extension->auto_local_infile= ACCEPT_FILE_REQUEST;
}
return mysql->methods->db_command(mysql, command, arg, length, skipp_check, opt_arg);
}