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