mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
patch
client/mysqldump.c: Add description of quote_for_like Add quoting of \ to \\\\ in quote_for_like Add DBUG_* Rearranged code in dump_selected_tables so the first thing it will do is to check that the tables to dump are available Unless --force is used, program will exit if not all specified tables can be found Add files to dump to HASH table for easy iteration Simpler handling of ignore_table list. Add new error code used when table user selected to dump can not be found in db client/mysqltest.c: Make it possible to exec a command that fails by setting --error <errno> before the command to exec. Check that the error returned from executed program matches the expected error. Add DBUG_* printouts mysql-test/mysql-test-run.sh: export MYSQL_DUMP_DIR used in "--replace_result" mysql-test/r/mysqldump.result: Added test for illegal / nonexisting table and database names mysql-test/t/mysqldump.test: Added test for illegal / nonexisting table and database names
This commit is contained in:
@ -688,6 +688,9 @@ MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --soc
|
||||
if [ "x$USE_EMBEDDED_SERVER" = "x1" ]; then
|
||||
MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST -A --language=$LANGUAGE -A --datadir=$SLAVE_MYDDIR -A --character-sets-dir=$CHARSETSDIR"
|
||||
fi
|
||||
# Save path and name of mysqldump
|
||||
MYSQL_DUMP_DIR="$MYSQL_DUMP"
|
||||
export MYSQL_DUMP_DIR
|
||||
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
|
||||
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
|
||||
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
|
||||
|
@ -1409,3 +1409,30 @@ CREATE TABLE `t2` (
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
DROP DATABASE mysqldump_test_db;
|
||||
create database mysqldump_test_db;
|
||||
use mysqldump_test_db;
|
||||
create table t1(a varchar(30) primary key, b int not null);
|
||||
create table t2(a varchar(30) primary key, b int not null);
|
||||
create table t3(a varchar(30) primary key, b int not null);
|
||||
test_sequence
|
||||
------ Testing with illegal table names ------
|
||||
MYSQL_DUMP_DIR: Couldn't find table: "\d-2-1.sql"
|
||||
|
||||
MYSQL_DUMP_DIR: Couldn't find table: "\t1"
|
||||
|
||||
MYSQL_DUMP_DIR: Couldn't find table: "\t1"
|
||||
|
||||
MYSQL_DUMP_DIR: Couldn't find table: "\\t1"
|
||||
|
||||
MYSQL_DUMP_DIR: Couldn't find table: "t\1"
|
||||
|
||||
MYSQL_DUMP_DIR: Couldn't find table: "t\1"
|
||||
|
||||
MYSQL_DUMP_DIR: Couldn't find table: "t/1"
|
||||
|
||||
test_sequence
|
||||
------ Testing with illegal database names ------
|
||||
MYSQL_DUMP_DIR: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database
|
||||
MYSQL_DUMP_DIR: Got error: 1102: Incorrect database name 'mysqld\ump_test_db' when selecting the database
|
||||
drop table t1, t2, t3;
|
||||
drop database mysqldump_test_db;
|
||||
|
@ -558,3 +558,81 @@ INSERT INTO t2 VALUES (1), (2);
|
||||
--exec $MYSQL_DUMP --skip-comments --no-data mysqldump_test_db t1 t2
|
||||
DROP TABLE t1, t2;
|
||||
DROP DATABASE mysqldump_test_db;
|
||||
|
||||
#
|
||||
# Testing with tables and databases that don't exists
|
||||
# or contains illegal characters
|
||||
# (Bug #9358 mysqldump crashes if tablename starts with \)
|
||||
#
|
||||
create database mysqldump_test_db;
|
||||
use mysqldump_test_db;
|
||||
create table t1(a varchar(30) primary key, b int not null);
|
||||
create table t2(a varchar(30) primary key, b int not null);
|
||||
create table t3(a varchar(30) primary key, b int not null);
|
||||
|
||||
--disable_query_log
|
||||
select '------ Testing with illegal table names ------' as test_sequence ;
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\d-2-1.sql" 2>&1
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\t1" 2>&1
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\1" 2>&1
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\\1" 2>&1
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t/1" 2>&1
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T_1"
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T%1"
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T'1"
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T_1"
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T_"
|
||||
|
||||
--disable_query_log
|
||||
select '------ Testing with illegal database names ------' as test_sequence ;
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 2
|
||||
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_d 2>&1
|
||||
|
||||
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
|
||||
--error 2
|
||||
--exec $MYSQL_DUMP --compact --skip-comments "mysqld\ump_test_db" 2>&1
|
||||
|
||||
drop table t1, t2, t3;
|
||||
drop database mysqldump_test_db;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user