summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/client/mariadb-conv-cp932.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/client/mariadb-conv-cp932.test')
-rw-r--r--mysql-test/suite/client/mariadb-conv-cp932.test57
1 files changed, 57 insertions, 0 deletions
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