未验证 提交 ae8a7013 编写于 作者: A alexey-milovidov 提交者: GitHub

Merge pull request #9079 from yurriy/mysql

Send string columns to mysql client as utf8
......@@ -103,6 +103,7 @@ size_t getLengthEncodedStringSize(const String & s)
ColumnDefinition getColumnDefinition(const String & column_name, const TypeIndex type_index)
{
ColumnType column_type;
CharacterSet charset = CharacterSet::binary;
int flags = 0;
switch (type_index)
{
......@@ -157,12 +158,14 @@ ColumnDefinition getColumnDefinition(const String & column_name, const TypeIndex
case TypeIndex::String:
case TypeIndex::FixedString:
column_type = ColumnType::MYSQL_TYPE_STRING;
charset = CharacterSet::utf8_general_ci;
break;
default:
column_type = ColumnType::MYSQL_TYPE_STRING;
charset = CharacterSet::utf8_general_ci;
break;
}
return ColumnDefinition(column_name, CharacterSet::binary, 0, column_type, flags, 0);
return ColumnDefinition(column_name, charset, 0, column_type, flags, 0);
}
}
......@@ -9,7 +9,7 @@ Columns:
name
a
Column types:
name BINARY
name CHAR
a TINYINT
Result:
tables 1
......@@ -17,7 +17,7 @@ Columns:
a
b
Column types:
a BINARY
a CHAR
b TINYINT
Result:
тест 1
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册