summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-10-11 22:51:01 +0400
committerAlexander Barkov <bar@mariadb.com>2019-10-11 22:51:01 +0400
commita0d3a351b8c5c2eb757270f31f9741b94f88ff1d (patch)
tree66162c7361efac12d007c476b2c4a070a23d8e97 /storage
parent5d6d28f274e38a7691fa30a6674452ad6c8870fd (diff)
downloadmariadb-git-a0d3a351b8c5c2eb757270f31f9741b94f88ff1d.tar.gz
MDEV-20790 CSV table with INET6 can be created and inserted into, but cannot be read from
Diffstat (limited to 'storage')
-rw-r--r--storage/csv/ha_tina.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index e67a43a3c1b..e5c980e0c28 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -821,6 +821,16 @@ int ha_tina::find_current_row(uchar *buf)
{
bool is_enum= ((*field)->real_type() == MYSQL_TYPE_ENUM);
/*
+ If "field" distinguishes between text and binary formats (e.g. INET6),
+ we cannot pass buffer.char() (which is &my_charset_bin) to store(),
+ to avoid "field" mis-interpreting the data format as binary.
+ Let's pass my_charset_latin1 to tell the field that we're storing
+ in text format.
+ */
+ CHARSET_INFO *storecs=
+ (*field)->type_handler()->convert_to_binary_using_val_native() ?
+ &my_charset_latin1 : buffer.charset();
+ /*
Here CHECK_FIELD_WARN checks that all values in the csv file are valid
which is normally the case, if they were written by
INSERT -> ha_tina::write_row. '0' values on ENUM fields are considered
@@ -828,7 +838,7 @@ int ha_tina::find_current_row(uchar *buf)
Thus, for enums we silence the warning, as it doesn't really mean
an invalid value.
*/
- if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset(),
+ if ((*field)->store(buffer.ptr(), buffer.length(), storecs,
is_enum ? CHECK_FIELD_IGNORE : CHECK_FIELD_WARN))
{
if (!is_enum)