1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-34883 LOAD DATA INFILE with geometry data fails

We write field using field data charset, so we should read it
using the field charset.
This commit is contained in:
Oleksandr Byelkin
2024-10-16 13:28:20 +02:00
parent c00145de58
commit 600c42ea86
3 changed files with 112 additions and 5 deletions

View File

@ -245,7 +245,7 @@ public:
String &field_term,String &line_start,String &line_term,
String &enclosed,int escape,bool get_it_from_net, bool is_fifo);
~READ_INFO();
int read_field();
int read_field(CHARSET_INFO *cs);
int read_fixed_length(void);
int next_line(void);
char unescape(char chr);
@ -1124,7 +1124,15 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
{
uint length;
uchar *pos;
if (read_info.read_field())
CHARSET_INFO *cs;
/*
Avoiding of handling binary data as a text
*/
if(item->charset_for_protocol() == &my_charset_bin)
cs= &my_charset_bin;
else
cs= read_info.charset();
if (read_info.read_field(cs))
break;
/* If this line is to be skipped we don't want to fill field or var */
@ -1497,7 +1505,7 @@ inline bool READ_INFO::terminator(const uchar *ptr, uint length)
must make sure to use escapes properly.
*/
int READ_INFO::read_field()
int READ_INFO::read_field(CHARSET_INFO *cs)
{
int chr,found_enclosed_char;
@ -1533,7 +1541,7 @@ int READ_INFO::read_field()
for (;;)
{
// Make sure we have enough space for the longest multi-byte character.
while (data.length() + charset()->mbmaxlen <= data.alloced_length())
while (data.length() + cs->mbmaxlen <= data.alloced_length())
{
chr = GET;
if (chr == my_b_EOF)
@ -1619,7 +1627,7 @@ int READ_INFO::read_field()
}
}
data.append(chr);
if (charset()->use_mb() && read_mbtail(&data))
if (cs->use_mb() && read_mbtail(&data))
goto found_eof;
}
/*