Skip to content

Commit

Permalink
MDEV-16220 MTR - do not pass UTF8 on the command line for mysql client.
Browse files Browse the repository at this point in the history
It should work ok on all Unixes, but on Windows ,only worked by accident
in the past, with client not being Unicode safe.

It stopped working with Visual Studio 2017 15.7 update now.
  • Loading branch information
vaintroub committed May 18, 2018
1 parent 1b2078b commit 27a7365
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 23 deletions.
5 changes: 0 additions & 5 deletions mysql-test/r/grant.result
Original file line number Diff line number Diff line change
Expand Up @@ -1647,11 +1647,6 @@ drop user mysqluser11@localhost;
drop database mysqltest1;
End of 5.0 tests
set names utf8;
grant select on test.* to юзер_юзер@localhost;
user()
юзер_юзер@localhost
revoke all on test.* from юзер_юзер@localhost;
drop user юзер_юзер@localhost;
grant select on test.* to очень_длинный_юзер@localhost;
ERROR HY000: String 'очень_длинный_юзер' is too long for user name (should be no longer than 16)
set names default;
Expand Down
7 changes: 7 additions & 0 deletions mysql-test/r/grant_not_windows.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set names utf8;
grant select on test.* to юзер_юзер@localhost;
user()
юзер_юзер@localhost
revoke all on test.* from юзер_юзер@localhost;
drop user юзер_юзер@localhost;
set names default;
8 changes: 0 additions & 8 deletions mysql-test/t/grant.test
Original file line number Diff line number Diff line change
Expand Up @@ -1574,15 +1574,7 @@ drop database mysqltest1;


--echo End of 5.0 tests

#
# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
#
set names utf8;
grant select on test.* to юзер_юзер@localhost;
--exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
revoke all on test.* from юзер_юзер@localhost;
drop user юзер_юзер@localhost;
--error ER_WRONG_STRING_LENGTH
grant select on test.* to очень_длинный_юзер@localhost;
set names default;
Expand Down
13 changes: 13 additions & 0 deletions mysql-test/t/grant_not_windows.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# UTF8 parameters to mysql client do not work on Windows
--source include/not_windows.inc
--source include/not_embedded.inc

#
# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
#
set names utf8;
grant select on test.* to юзер_юзер@localhost;
--exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
revoke all on test.* from юзер_юзер@localhost;
drop user юзер_юзер@localhost;
set names default;
16 changes: 12 additions & 4 deletions mysql-test/t/mysql.test
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,22 @@ drop table t1;

#
# Bug#17939 Wrong table format when using UTF8 strings
#
--exec $MYSQL --default-character-set=utf8 --table -e "SELECT 'John Doe' as '__tañgè Ñãmé'" 2>&1
--exec $MYSQL --default-character-set=utf8 --table -e "SELECT '__tañgè Ñãmé' as 'John Doe'" 2>&1
write_file $MYSQL_TMP_DIR/mysql_in;
SELECT 'John Doe' as '__tañgè Ñãmé';
SELECT '__tañgè Ñãmé' as 'John Doe';
EOF
--exec $MYSQL --default-character-set=utf8 --table < $MYSQL_TMP_DIR/mysql_in 2>&1
remove_file $MYSQL_TMP_DIR/mysql_in;

#
# Bug#18265 -- mysql client: No longer right-justifies numeric columns
#
--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int, k char(25) charset utf8); insert into t1 (i) values (1); insert into t1 (k) values ('<----------------------->'); insert into t1 (k) values ('<-----'); insert into t1 (k) values ('Τη γλώσσα'); insert into t1 (k) values ('ᛖᚴ ᚷᛖᛏ'); select * from t1; DROP TABLE t1;"
write_file $MYSQL_TMP_DIR/mysql_in;
create table t1 (i int, j int, k char(25) charset utf8); insert into t1 (i) values (1); insert into t1 (k) values ('<----------------------->'); insert into t1 (k) values ('<-----'); insert into t1 (k) values ('Τη γλώσσα'); insert into t1 (k) values ('ᛖᚴ ᚷᛖᛏ'); select * from t1; DROP TABLE t1;
EOF
--exec $MYSQL -t --default-character-set utf8 test < $MYSQL_TMP_DIR/mysql_in
remove_file $MYSQL_TMP_DIR/mysql_in;


#
# "DESCRIBE" commands may return strange NULLness flags.
Expand Down
42 changes: 36 additions & 6 deletions mysql-test/t/mysql_cp932.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,43 @@
# BUG#16217 - MySQL client misinterprets multi-byte char as escape `\'
#

let $mysql_in= $MYSQL_TMP_DIR/mysql_in;

# new command \C or charset
--exec $MYSQL --default-character-set=utf8 test -e "\C cp932 \g"
--exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
write_file $mysql_in;
\C cp932 \g
EOF
--exec $MYSQL --default-character-set=utf8 test < $mysql_in
remove_file $mysql_in;

write_file $mysql_in;
charset utf8;
EOF
--exec $MYSQL --default-character-set=cp932 test < $mysql_in
remove_file $mysql_in;

# its usage to switch internally in mysql to requested charset
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select '�\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('�\'); select * from t1; drop table t1;"
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select '�\'"
--exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select '�\'"
--exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select '�\'"
write_file $mysql_in;
charset cp932; select '�\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('�\'); select * from t1; drop table t1;
EOF
--exec $MYSQL --default-character-set=utf8 test < $mysql_in
remove_file $mysql_in;

write_file $mysql_in;
charset cp932; select '�\'
EOF
--exec $MYSQL --default-character-set=utf8 test < $mysql_in
remove_file $mysql_in;

write_file $mysql_in;
/*charset cp932 */; set character_set_client= cp932; select '�\'
EOF
--exec $MYSQL --default-character-set=utf8 test < $mysql_in
remove_file $mysql_in;

write_file $mysql_in;
/*!\C cp932 */; set character_set_client= cp932; select '�\'
EOF
--exec $MYSQL --default-character-set=utf8 test < $mysql_in
remove_file $mysql_in;

0 comments on commit 27a7365

Please sign in to comment.