Skip to content

Commit 2ccf6a2

Browse files
vaintroubsanja-byelkin
authored andcommitted
MDEV-37483 - fix output differences Linux vs Windows in the test
- Do not mix latin1 and utf8 in the test and result file. Not only it looks strange, and it does not work on Windows either. - Fix --default-character-set usage in mariadb-import. Prior to patch it was just using platform default when communicating with server. Now, it uses the charset provided by the option. - Use --default-character-set=utf8mb4 in test, to have uniform output across different OSes.
1 parent 1b5fb40 commit 2ccf6a2

File tree

3 files changed

+25
-27
lines changed

3 files changed

+25
-27
lines changed

client/mysqlimport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ static int write_to_table(char *filename, MYSQL *mysql)
343343
if (strchr(tablename, '@'))
344344
{
345345
uint errors, len;
346-
const char *csname= my_default_csname(); /* see MYSQL_SET_CHARSET_NAME */
347-
CHARSET_INFO *cs= get_charset_by_csname(csname, MY_CS_PRIMARY, MYF(0));
346+
CHARSET_INFO *cs=
347+
get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(0));
348348
len= my_convert(escaped_name, sizeof(escaped_name) - 1, cs, tablename,
349349
(uint32)strlen(tablename), &my_charset_filename, &errors);
350350
if (!errors)
@@ -498,7 +498,7 @@ static MYSQL *db_connect(char *host, char *database,
498498
mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
499499
if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME))
500500
default_charset= (char *)my_default_csname();
501-
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, my_default_csname());
501+
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
502502
mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
503503
mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
504504
"program_name", "mysqlimport");

mysql-test/main/mysqldump.result

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6627,33 +6627,32 @@ drop table t1;
66276627
#
66286628
# MDEV-37483 mariadb-dump -T doesn't convert table names
66296629
#
6630-
set names latin1;
66316630
create database foo;
66326631
use foo;
6633-
create table `con_sch�ne_gr��e` (a int) select 1 as a;
6632+
create table `con_schöne_grüße` (a int) select 1 as a;
66346633
create table `con` (b int) select 2 as b;
66356634
create table `con/bar` (c int) select 3 as c;
6636-
create table `con@home` (d int) select 4 as d;
6635+
create table `con@fame` (d int) select 4 as d;
66376636
drop database foo;
66386637
use test;
66396638
66406639
66416640
con@@@.sql
66426641
con@@@.txt
6643-
con@home.sql
6644-
con@home.txt
6642+
con@fame.sql
6643+
con@fame.txt
66456644
con_sch@1ine_gr@[email protected]
66466645
con_sch@1ine_gr@[email protected]
66476646
show tables;
66486647
Tables_in_test
66496648
con
66506649
con/bar
6651-
con@home
6652-
con_sch�ne_gr��e
6650+
con@fame
6651+
con_schöne_grüße
66536652
test.con: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
66546653
test.con/bar: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
6655-
test.con@home: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
6656-
select * from `con_sch�ne_gr��e`;
6654+
test.con@fame: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
6655+
select * from `con_schöne_grüße`;
66576656
a
66586657
1
66596658
select * from `con`;
@@ -6662,11 +6661,11 @@ b
66626661
select * from `con/bar`;
66636662
c
66646663
3
6665-
select * from `con@home`;
6664+
select * from `con@fame`;
66666665
d
66676666
4
6668-
drop table `con_sch�ne_gr��e`;
6667+
drop table `con_schöne_grüße`;
66696668
drop table `con`;
66706669
drop table `con/bar`;
6671-
drop table `con@home`;
6670+
drop table `con@fame`;
66726671
# End of 10.6 tests

mysql-test/main/mysqldump.test

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3039,41 +3039,40 @@ drop table t1;
30393039
--echo #
30403040
--echo # MDEV-37483 mariadb-dump -T doesn't convert table names
30413041
--echo #
3042-
set names latin1;
30433042
create database foo;
30443043
use foo;
30453044

3046-
create table `con_sch�ne_gr��e` (a int) select 1 as a;
3045+
create table `con_schöne_grüße` (a int) select 1 as a;
30473046
create table `con` (b int) select 2 as b;
30483047
create table `con/bar` (c int) select 3 as c;
3049-
create table `con@home` (d int) select 4 as d;
3048+
create table `con@fame` (d int) select 4 as d;
30503049
exec $MYSQL_DUMP foo --tab $MYSQLTEST_VARDIR/tmp;
30513050
drop database foo;
30523051
use test;
3053-
move_file $MYSQLTEST_VARDIR/tmp/con@0040home.sql $MYSQLTEST_VARDIR/tmp/con@home.sql;
3054-
move_file $MYSQLTEST_VARDIR/tmp/con@0040home.txt $MYSQLTEST_VARDIR/tmp/con@home.txt;
3052+
move_file $MYSQLTEST_VARDIR/tmp/con@0040fame.sql $MYSQLTEST_VARDIR/tmp/con@fame.sql;
3053+
move_file $MYSQLTEST_VARDIR/tmp/con@0040fame.txt $MYSQLTEST_VARDIR/tmp/con@fame.txt;
30553054
list_files $MYSQLTEST_VARDIR/tmp con*;
30563055
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@@@.sql;
30573056
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/[email protected];
30583057
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@[email protected];
3059-
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@home.sql;
3058+
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@fame.sql;
30603059
show tables;
30613060
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@@@.txt;
30623061
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/[email protected];
30633062
if (`select @@version like '10.6.%'`) {
30643063
# utf8 console output on Windows is fixed in MDEV-26713, until then
30653064
--disable_result_log
30663065
}
3067-
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@[email protected];
3066+
exec $MYSQL_IMPORT --default-character-set=utf8mb4 test $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@[email protected];
30683067
--enable_result_log
3069-
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@home.txt;
3070-
select * from `con_sch�ne_gr��e`;
3068+
exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@fame.txt;
3069+
select * from `con_schöne_grüße`;
30713070
select * from `con`;
30723071
select * from `con/bar`;
3073-
select * from `con@home`;
3074-
drop table `con_sch�ne_gr��e`;
3072+
select * from `con@fame`;
3073+
drop table `con_schöne_grüße`;
30753074
drop table `con`;
30763075
drop table `con/bar`;
3077-
drop table `con@home`;
3076+
drop table `con@fame`;
30783077

30793078
--echo # End of 10.6 tests

0 commit comments

Comments
 (0)