summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/client
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/client
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/client')
-rw-r--r--mysql-test/suite/client/mariadb-conv-cp932.result49
-rw-r--r--mysql-test/suite/client/mariadb-conv-cp932.test57
-rw-r--r--mysql-test/suite/client/mariadb-conv-utf16.result13
-rw-r--r--mysql-test/suite/client/mariadb-conv-utf16.test21
-rw-r--r--mysql-test/suite/client/mariadb-conv-utf8.result49
-rw-r--r--mysql-test/suite/client/mariadb-conv-utf8.test57
-rw-r--r--mysql-test/suite/client/mariadb-conv.result25
-rw-r--r--mysql-test/suite/client/mariadb-conv.test39
8 files changed, 310 insertions, 0 deletions
diff --git a/mysql-test/suite/client/mariadb-conv-cp932.result b/mysql-test/suite/client/mariadb-conv-cp932.result
new file mode 100644
index 00000000..efa428b9
--- /dev/null
+++ b/mysql-test/suite/client/mariadb-conv-cp932.result
@@ -0,0 +1,49 @@
+#
+# MDEV-17088 Provide tools to encode/decode mysql-encoded file system names
+#
+SET NAMES cp932;
+@6e2c@8a66@8cc7@6599
+‘ͺŽŽŽ‘—ΏŒΙ
+@6e2c@8a66@8cc7@6599
+‘ͺŽŽŽ‘—Ώ
+‘ͺŽŽŽ‘—ΏŒΙ
+@6e2c@8a66@8cc7@6599@5eab
+# bulk convert with pipe
+CREATE TABLE t1 (id SERIAL, a VARCHAR(64) CHARACTER SET cp932);
+INSERT INTO t1 (a) VALUES ('‘ͺŽŽŽ‘—Ώ'), ('‘ͺŽŽŽ‘—Ώ2');
+a
+@6e2c@8a66@8cc7@6599
+@6e2c@8a66@8cc7@65992
+BINARY CONVERT(a USING filename)
+@6e2c@8a66@8cc7@6599
+@6e2c@8a66@8cc7@65992
+‘ͺŽŽŽ‘—Ώ
+‘ͺŽŽŽ‘—Ώ2
+test/‘ͺŽŽŽ‘—Ώ.frm
+test/‘ͺŽŽŽ‘—Ώ2.frm
+test/‘ͺŽŽŽ‘—Ώ.frm
+test/‘ͺŽŽŽ‘—Ώ2.frm
+DROP TABLE t1;
+# bulk convert with file
+# --- Start of mariadb-conv for mysql-conv-test-cp932.txt ---
+
+@6e2c@8a66@8cc7@6599
+
+@6e2c@8a66@8cc7@65992
+@6e2c@8a66@8cc7@65993
+
+# --- End of mariadb-conv for mysql-conv-test-cp932.txt ---
+# --- Start of mariadb-conv for mysql-conv-test-cp932.txt and mysql-conv-test-cp932-2.txt ---
+
+@6e2c@8a66@8cc7@6599
+
+@6e2c@8a66@8cc7@65992
+@6e2c@8a66@8cc7@65993
+
+
+@6e2c@8a66@8cc7@6599
+
+@6e2c@8a66@8cc7@65992
+@6e2c@8a66@8cc7@65993
+
+# --- Start of mariadb-conv for mysql-conv-test-cp932.txt and mysql-conv-test-cp932-2.txt ---
diff --git a/mysql-test/suite/client/mariadb-conv-cp932.test b/mysql-test/suite/client/mariadb-conv-cp932.test
new file mode 100644
index 00000000..1a9263b3
--- /dev/null
+++ b/mysql-test/suite/client/mariadb-conv-cp932.test
@@ -0,0 +1,57 @@
+-- source include/not_embedded.inc
+
+--echo #
+--echo # MDEV-17088 Provide tools to encode/decode mysql-encoded file system names
+--echo #
+
+--character_set cp932
+SET NAMES cp932;
+
+--let $MYSQLD_DATADIR= `select @@datadir`
+
+# simple I/O
+--exec echo "‘ͺŽŽŽ‘—Ώ" | $MARIADB_CONV -f cp932 -t filename --delimiter="\r\n"
+--exec echo "@6e2c@8a66@8cc7@6599@5eab" | $MARIADB_CONV -f filename -t cp932 --delimiter="\r\n"
+
+# undo query result
+--let $query_result=`SELECT CONVERT(CONVERT('‘ͺŽŽŽ‘—Ώ' USING filename) USING binary);`
+--echo $query_result
+--exec echo $query_result | $MARIADB_CONV -f filename -t cp932 --delimiter="\r\n"
+
+--let $reverse_query_result=`SELECT CONVERT(_filename '@6e2c@8a66@8cc7@6599@5eab' USING cp932);`
+--echo $reverse_query_result
+--exec echo $reverse_query_result | $MARIADB_CONV -f cp932 -t filename --delimiter="\r\n"
+
+--echo # bulk convert with pipe
+
+CREATE TABLE t1 (id SERIAL, a VARCHAR(64) CHARACTER SET cp932);
+INSERT INTO t1 (a) VALUES ('‘ͺŽŽŽ‘—Ώ'), ('‘ͺŽŽŽ‘—Ώ2');
+--exec $MYSQL -Dtest --default-character-set=cp932 -e "SELECT a FROM t1 ORDER BY id" | $MARIADB_CONV -f cp932 -t filename --delimiter="\r\n"
+--exec $MYSQL -Dtest --default-character-set=cp932 -e "SELECT BINARY CONVERT(a USING filename) FROM t1 ORDER BY id"
+--exec $MYSQL -Dtest --default-character-set=cp932 --column-names=0 -e "SELECT BINARY CONVERT(a USING filename) FROM t1 ORDER BY id" | $MARIADB_CONV -f filename -t cp932 --delimiter="\r\n"
+--exec $MYSQL -Dtest --default-character-set=cp932 --column-names=0 -e "SELECT CONCAT('test/', BINARY CONVERT(a USING filename),'.frm') FROM t1 ORDER BY id" | $REPLACE "/" "@002f" "." "@002e"| $MARIADB_CONV -f filename -t cp932 --delimiter="\r\n"
+--exec $MYSQL -Dtest --default-character-set=cp932 --column-names=0 -e "SELECT CONCAT('test/', BINARY CONVERT(a USING filename),'.frm') FROM t1 ORDER BY id" | $MARIADB_CONV -f filename -t cp932 --delimiter="/.\r\n"
+DROP TABLE t1;
+
+
+--echo # bulk convert with file
+--write_file $MYSQL_TMP_DIR/mysql-conv-test-cp932.txt
+
+‘ͺŽŽŽ‘—Ώ
+
+‘ͺŽŽŽ‘—Ώ2
+‘ͺŽŽŽ‘—Ώ3
+
+EOF
+
+--echo # --- Start of mariadb-conv for mysql-conv-test-cp932.txt ---
+--exec $MARIADB_CONV -f cp932 -t filename --delimiter="\r\n" $MYSQL_TMP_DIR/mysql-conv-test-cp932.txt
+--echo # --- End of mariadb-conv for mysql-conv-test-cp932.txt ---
+
+--copy_file $MYSQL_TMP_DIR/mysql-conv-test-cp932.txt $MYSQL_TMP_DIR/mysql-conv-test-cp932-2.txt
+--echo # --- Start of mariadb-conv for mysql-conv-test-cp932.txt and mysql-conv-test-cp932-2.txt ---
+--exec $MARIADB_CONV -f cp932 -t filename --delimiter="\r\n" $MYSQL_TMP_DIR/mysql-conv-test-cp932.txt $MYSQL_TMP_DIR/mysql-conv-test-cp932-2.txt
+--echo # --- Start of mariadb-conv for mysql-conv-test-cp932.txt and mysql-conv-test-cp932-2.txt ---
+
+--remove_file $MYSQL_TMP_DIR/mysql-conv-test-cp932.txt
+--remove_file $MYSQL_TMP_DIR/mysql-conv-test-cp932-2.txt
diff --git a/mysql-test/suite/client/mariadb-conv-utf16.result b/mysql-test/suite/client/mariadb-conv-utf16.result
new file mode 100644
index 00000000..bec906e7
--- /dev/null
+++ b/mysql-test/suite/client/mariadb-conv-utf16.result
@@ -0,0 +1,13 @@
+#
+# MDEV-17088 Provide tools to encode/decode mysql-encoded file system names
+#
+SET NAMES utf8;
+# Bad delimiter
+--delimiter cannot be used with utf16 to utf8mb3 conversion
+# Bad delimiter
+--delimiter cannot be used with utf8mb3 to utf16 conversion
+# Start of file01.utf16.txt
+aaa
+xxxяяяxxx
+bbb
+# End of file01.utf16.txt
diff --git a/mysql-test/suite/client/mariadb-conv-utf16.test b/mysql-test/suite/client/mariadb-conv-utf16.test
new file mode 100644
index 00000000..98f9e8d2
--- /dev/null
+++ b/mysql-test/suite/client/mariadb-conv-utf16.test
@@ -0,0 +1,21 @@
+-- source include/have_utf16.inc
+-- source include/not_embedded.inc
+
+--echo #
+--echo # MDEV-17088 Provide tools to encode/decode mysql-encoded file system names
+--echo #
+
+--character_set utf8
+SET NAMES utf8;
+
+--echo # Bad delimiter
+--error 1
+--exec $MARIADB_CONV -f utf16 -t utf8 --delimiter="\r\n" $MYSQL_TEST_DIR/std_data/mariadb-conv/file01.utf16.txt 2>&1
+
+--echo # Bad delimiter
+--error 1
+--exec $MARIADB_CONV -f utf8 -t utf16 --delimiter="\r\n" $MYSQL_TEST_DIR/std_data/mariadb-conv/file01.utf8.txt 2>&1
+
+--echo # Start of file01.utf16.txt
+--exec $MARIADB_CONV -f utf16 -t utf8 $MYSQL_TEST_DIR/std_data/mariadb-conv/file01.utf16.txt 2>&1
+--echo # End of file01.utf16.txt
diff --git a/mysql-test/suite/client/mariadb-conv-utf8.result b/mysql-test/suite/client/mariadb-conv-utf8.result
new file mode 100644
index 00000000..cae8268d
--- /dev/null
+++ b/mysql-test/suite/client/mariadb-conv-utf8.result
@@ -0,0 +1,49 @@
+#
+# MDEV-17088 Provide tools to encode/decode mysql-encoded file system names
+#
+SET NAMES utf8;
+@6e2c@8a66@8cc7@6599
+測試資料庫
+@6e2c@8a66@8cc7@6599
+測試資料
+測試資料庫
+@6e2c@8a66@8cc7@6599@5eab
+# bulk convert with pipe
+CREATE TABLE t1 (id SERIAL, a VARCHAR(64) CHARACTER SET utf8);
+INSERT INTO t1 (a) VALUES ('測試資料'), ('測試資料2');
+a
+@6e2c@8a66@8cc7@6599
+@6e2c@8a66@8cc7@65992
+BINARY CONVERT(a USING filename)
+@6e2c@8a66@8cc7@6599
+@6e2c@8a66@8cc7@65992
+測試資料
+測試資料2
+test/測試資料.frm
+test/測試資料2.frm
+test/測試資料.frm
+test/測試資料2.frm
+DROP TABLE t1;
+# bulk convert with file
+# --- Start of mariadb-conv for mysql-conv-test-utf8.txt ---
+
+@6e2c@8a66@8cc7@6599
+
+@6e2c@8a66@8cc7@65992
+@6e2c@8a66@8cc7@65993
+
+# --- End of mariadb-conv for mysql-conv-test-utf8.txt ---
+# --- Start of mariadb-conv for mysql-conv-test-utf8.txt and mysql-conv-test-utf8-2.txt ---
+
+@6e2c@8a66@8cc7@6599
+
+@6e2c@8a66@8cc7@65992
+@6e2c@8a66@8cc7@65993
+
+
+@6e2c@8a66@8cc7@6599
+
+@6e2c@8a66@8cc7@65992
+@6e2c@8a66@8cc7@65993
+
+# --- Start of mariadb-conv for mysql-conv-test-utf8.txt and mysql-conv-test-utf8-2.txt ---
diff --git a/mysql-test/suite/client/mariadb-conv-utf8.test b/mysql-test/suite/client/mariadb-conv-utf8.test
new file mode 100644
index 00000000..5002aadd
--- /dev/null
+++ b/mysql-test/suite/client/mariadb-conv-utf8.test
@@ -0,0 +1,57 @@
+-- source include/not_embedded.inc
+
+--echo #
+--echo # MDEV-17088 Provide tools to encode/decode mysql-encoded file system names
+--echo #
+
+--character_set utf8
+SET NAMES utf8;
+
+--let $MYSQLD_DATADIR= `select @@datadir`
+
+# simple I/O
+--exec echo "測試資料" | $MARIADB_CONV -f utf8 -t filename --delimiter="\r\n"
+--exec echo "@6e2c@8a66@8cc7@6599@5eab" | $MARIADB_CONV -f filename -t utf8 --delimiter="\r\n"
+
+# undo query result
+--let $query_result=`SELECT CONVERT(CONVERT('測試資料' USING filename) USING binary);`
+--echo $query_result
+--exec echo $query_result | $MARIADB_CONV -f filename -t utf8 --delimiter="\r\n"
+
+--let $reverse_query_result=`SELECT CONVERT(_filename '@6e2c@8a66@8cc7@6599@5eab' USING utf8);`
+--echo $reverse_query_result
+--exec echo $reverse_query_result | $MARIADB_CONV -f utf8 -t filename --delimiter="\r\n"
+
+--echo # bulk convert with pipe
+
+CREATE TABLE t1 (id SERIAL, a VARCHAR(64) CHARACTER SET utf8);
+INSERT INTO t1 (a) VALUES ('測試資料'), ('測試資料2');
+--exec $MYSQL -Dtest --default-character-set=utf8 -e "SELECT a FROM t1 ORDER BY id" | $MARIADB_CONV -f utf8 -t filename --delimiter="\r\n"
+--exec $MYSQL -Dtest --default-character-set=utf8 -e "SELECT BINARY CONVERT(a USING filename) FROM t1 ORDER BY id"
+--exec $MYSQL -Dtest --default-character-set=utf8 --column-names=0 -e "SELECT BINARY CONVERT(a USING filename) FROM t1 ORDER BY id" | $MARIADB_CONV -f filename -t utf8 --delimiter="\r\n"
+--exec $MYSQL -Dtest --default-character-set=utf8 --column-names=0 -e "SELECT CONCAT('test/', BINARY CONVERT(a USING filename),'.frm') FROM t1 ORDER BY id" | $REPLACE "/" "@002f" "." "@002e"| $MARIADB_CONV -f filename -t utf8 --delimiter="\r\n"
+--exec $MYSQL -Dtest --default-character-set=utf8 --column-names=0 -e "SELECT CONCAT('test/', BINARY CONVERT(a USING filename),'.frm') FROM t1 ORDER BY id" | $MARIADB_CONV -f filename -t utf8 --delimiter="/.\r\n"
+DROP TABLE t1;
+
+
+--echo # bulk convert with file
+--write_file $MYSQL_TMP_DIR/mysql-conv-test-utf8.txt
+
+測試資料
+
+測試資料2
+測試資料3
+
+EOF
+
+--echo # --- Start of mariadb-conv for mysql-conv-test-utf8.txt ---
+--exec $MARIADB_CONV -f utf8 -t filename --delimiter="\r\n" $MYSQL_TMP_DIR/mysql-conv-test-utf8.txt
+--echo # --- End of mariadb-conv for mysql-conv-test-utf8.txt ---
+
+--copy_file $MYSQL_TMP_DIR/mysql-conv-test-utf8.txt $MYSQL_TMP_DIR/mysql-conv-test-utf8-2.txt
+--echo # --- Start of mariadb-conv for mysql-conv-test-utf8.txt and mysql-conv-test-utf8-2.txt ---
+--exec $MARIADB_CONV -f utf8 -t filename --delimiter="\r\n" $MYSQL_TMP_DIR/mysql-conv-test-utf8.txt $MYSQL_TMP_DIR/mysql-conv-test-utf8-2.txt
+--echo # --- Start of mariadb-conv for mysql-conv-test-utf8.txt and mysql-conv-test-utf8-2.txt ---
+
+--remove_file $MYSQL_TMP_DIR/mysql-conv-test-utf8.txt
+--remove_file $MYSQL_TMP_DIR/mysql-conv-test-utf8-2.txt
diff --git a/mysql-test/suite/client/mariadb-conv.result b/mysql-test/suite/client/mariadb-conv.result
new file mode 100644
index 00000000..dd4d2ee5
--- /dev/null
+++ b/mysql-test/suite/client/mariadb-conv.result
@@ -0,0 +1,25 @@
+#
+# MDEV-17088 Provide tools to encode/decode mysql-encoded file system names
+#
+# default encoding
+t1
+t1
+t1
+# invalid option
+mariadb-conv: unknown option '-r'
+# unknown "to" character set
+Character set unknown-cs is not supported
+# unknown "from" character set
+Character set unknown-cs is not supported
+# Bad delimiter
+Bad --delimiter value
+# Conversion error
+Conversion from utf8mb3 to latin1 failed at position 7
+aaa
+xxx???xxx
+bbb
+# Bad input character
+Illegal utf8mb3 byte sequence at position 7
+aaa
+xxx???xxx
+bbb
diff --git a/mysql-test/suite/client/mariadb-conv.test b/mysql-test/suite/client/mariadb-conv.test
new file mode 100644
index 00000000..2be758b6
--- /dev/null
+++ b/mysql-test/suite/client/mariadb-conv.test
@@ -0,0 +1,39 @@
+--echo #
+--echo # MDEV-17088 Provide tools to encode/decode mysql-encoded file system names
+--echo #
+
+--character_set latin1
+
+--echo # default encoding
+--exec echo "t1" | $MARIADB_CONV
+--exec echo "t1" | $MARIADB_CONV -f filename --delimiter="\r\n"
+--exec echo "t1" | $MARIADB_CONV -t filename --delimiter="\r\n"
+
+--echo # invalid option
+--replace_regex /.*mariadb-conv.*: unknown/mariadb-conv: unknown/
+--error 1
+--exec echo "t1" | $MARIADB_CONV -f filename -r latin1 2>&1 > /dev/null
+
+--echo # unknown "to" character set
+--replace_regex /.*mariadb-conv.*: unknown/mariadb-conv: unknown/
+--error 1
+--exec echo "t1" | $MARIADB_CONV -f filename -t unknown-cs 2>&1 > /dev/null
+
+--echo # unknown "from" character set
+--replace_regex /.*mariadb-conv.*: unknown/mariadb-conv: unknown/
+--error 1
+--exec echo "t1" | $MARIADB_CONV -f unknown-cs -t latin1 2>&1 > /dev/null
+
+--echo # Bad delimiter
+--error 1
+--exec echo "t1" | $MARIADB_CONV --delimiter="\x" 2>&1 > /dev/null
+
+--echo # Conversion error
+--error 1
+--exec $MARIADB_CONV -f utf8 -t latin1 < $MYSQL_TEST_DIR/std_data/mariadb-conv/file01.utf8.txt 2>&1
+--exec $MARIADB_CONV -f utf8 -t latin1 -c < $MYSQL_TEST_DIR/std_data/mariadb-conv/file01.utf8.txt 2>&1
+
+--echo # Bad input character
+--error 1
+--exec $MARIADB_CONV -f utf8 -t latin1 < $MYSQL_TEST_DIR/std_data/mariadb-conv/file02.latin1.txt 2>&1
+--exec $MARIADB_CONV -f utf8 -t latin1 -c < $MYSQL_TEST_DIR/std_data/mariadb-conv/file02.latin1.txt 2>&1