|
|
|
|
@ -114,16 +114,16 @@ int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
if (mysql_query(mysql, "set names 'utf8'")) return exit_status();
|
|
|
|
|
show_variable(mysql, var_collation_connection, var_value);
|
|
|
|
|
ok(var_value.compare("utf8_general_ci") == 0, "Initial client character set");
|
|
|
|
|
ok(var_value.compare("utf8_general_ci") == 0, "Initial client character set"); // ok_1
|
|
|
|
|
|
|
|
|
|
if (mysql_query(mysql, "set names utf8mb4 collate utf8mb4_croatian_ci")) return exit_status();
|
|
|
|
|
show_variable(mysql, var_collation_connection, var_value);
|
|
|
|
|
std::string version;
|
|
|
|
|
get_server_version(mysql, version);
|
|
|
|
|
if (version[0] == '5') {
|
|
|
|
|
ok(var_value.compare("utf8mb4_general_ci") == 0, "Backend is mysql version < 8.0. Collation is reduced to utf8mb4_general_ci as expected");
|
|
|
|
|
if (version.data()[0] == '5') {
|
|
|
|
|
ok(var_value.compare("utf8mb4_general_ci") == 0, "Backend is mysql version < 8.0. Collation is reduced to utf8mb4_general_ci as expected"); // ok_2
|
|
|
|
|
} else {
|
|
|
|
|
ok(var_value.compare("utf8mb4_croatian_ci") == 0, "Backend is mysql version >= 8.0. Collation is set as expected to utf8mb4_croatian_ci");
|
|
|
|
|
ok(var_value.compare("utf8mb4_croatian_ci") == 0, "Backend is mysql version >= 8.0. Collation is set as expected to utf8mb4_croatian_ci"); // ok_2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(mysql);
|
|
|
|
|
@ -139,31 +139,32 @@ int main(int argc, char** argv) {
|
|
|
|
|
if (mysql_query(mysql_a, "save mysql variables to disk")) return exit_status();
|
|
|
|
|
|
|
|
|
|
show_admin_global_variable(mysql_a, var_name, var_value);
|
|
|
|
|
ok(var_value.compare("latin1") == 0, "Default charset latin1 is set in admin");
|
|
|
|
|
ok(var_value.compare("latin1") == 0, "Default charset latin1 is set in admin"); // ok_3
|
|
|
|
|
|
|
|
|
|
if (mysql_query(mysql_a, "update global_variables set variable_value='utf8mb4' where variable_name='mysql-default_charset'")) return exit_status();
|
|
|
|
|
if (mysql_query(mysql_a, "load mysql variables to runtime")) return exit_status();
|
|
|
|
|
if (mysql_query(mysql_a, "save mysql variables to disk")) return exit_status();
|
|
|
|
|
|
|
|
|
|
show_admin_global_variable(mysql_a, var_name, var_value);
|
|
|
|
|
ok(var_value.compare("utf8mb4") == 0, "Default charset utf8mb4 is set in admin");
|
|
|
|
|
ok(var_value.compare("utf8mb4") == 0, "Default charset utf8mb4 is set in admin"); // ok_4
|
|
|
|
|
|
|
|
|
|
mysql_close(mysql_a);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Now default charset is utf8mb4 and new client connection should use it by default
|
|
|
|
|
MYSQL* mysql_b = mysql_init(NULL);
|
|
|
|
|
if (!mysql_b) return exit_status();
|
|
|
|
|
if (!mysql_real_connect(mysql_b, cl.host, cl.username, cl.password, NULL, cl.port, NULL, 0)) return exit_status();
|
|
|
|
|
|
|
|
|
|
get_server_version(mysql_b, version);
|
|
|
|
|
if (version[0] == '5') {
|
|
|
|
|
if (version.data()[0] == '5') {
|
|
|
|
|
show_variable(mysql_b, var_collation_connection, var_value);
|
|
|
|
|
ok(var_value.compare("utf8mb4_general_ci") == 0, "Collation 255 is set, because proxyserver changed it");
|
|
|
|
|
ok(var_value.compare("utf8mb4_general_ci") == 0, "Collation 255 is set, because proxyserver changed it"); // ok_5
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
show_variable(mysql_b, var_collation_connection, var_value);
|
|
|
|
|
ok(var_value.compare("utf8mb4_0900_ai_ci") == 0, "Collation >255 is set");
|
|
|
|
|
ok(var_value.compare("utf8mb4_0900_ai_ci") == 0, "Collation >255 is set"); // ok_5
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(mysql_b);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -174,13 +175,13 @@ int main(int argc, char** argv) {
|
|
|
|
|
if (!mysql_real_connect(mysql_c, cl.host, cl.username, cl.password, NULL, cl.port, NULL, 0)) return exit_status();
|
|
|
|
|
|
|
|
|
|
if (get_server_version(mysql_c, version)) return exit_status();
|
|
|
|
|
if (version[0] == '5') {
|
|
|
|
|
if (version.data()[0] == '5') {
|
|
|
|
|
show_variable(mysql_c, var_collation_connection, var_value);
|
|
|
|
|
ok(var_value.compare("utf8mb4_general_ci") == 0, "Collation 255 is set, because proxyserver changed it");
|
|
|
|
|
ok(var_value.compare("utf8mb4_general_ci") == 0, "Collation 255 is set, because proxyserver changed it"); // ok_6
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
show_variable(mysql_c, var_collation_connection, var_value);
|
|
|
|
|
ok(var_value.compare("utf8mb4_0900_ai_ci") == 0, "Collation >255 is set");
|
|
|
|
|
ok(var_value.compare("utf8mb4_0900_ai_ci") == 0, "Collation >255 is set"); // ok_6
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysql_close(mysql_c);
|
|
|
|
|
|