566 lines
		
	
	
		
			21 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			566 lines
		
	
	
		
			21 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								# This test should work in embedded server after we fix mysqltest
							 | 
						||
| 
								 | 
							
								-- source include/not_embedded.inc
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Testing the MySQL command line client(mysql)
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--disable_warnings
							 | 
						||
| 
								 | 
							
								drop table if exists t1;
							 | 
						||
| 
								 | 
							
								--enable_warnings
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Test the "delimiter" functionality
							 | 
						||
| 
								 | 
							
								# Bug#9879
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								create table t1(a int);
							 | 
						||
| 
								 | 
							
								insert into t1 values(1);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Test delimiters
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test 2>&1 < "./t/mysql_delimiter.sql"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--disable_query_log
							 | 
						||
| 
								 | 
							
								# Test delimiter : supplied on the command line
							 | 
						||
| 
								 | 
							
								select "Test delimiter : from command line" as "_";
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test --delimiter=":" -e "select * from t1:"
							 | 
						||
| 
								 | 
							
								# Test delimiter :; supplied on the command line
							 | 
						||
| 
								 | 
							
								select "Test delimiter :; from command line" as "_";
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test --delimiter=":;" -e "select * from t1:;"
							 | 
						||
| 
								 | 
							
								# Test 'go' command (vertical output) \G
							 | 
						||
| 
								 | 
							
								select "Test 'go' command(vertical output) \G" as "_";
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "select * from t1\G"
							 | 
						||
| 
								 | 
							
								# Test 'go' command \g
							 | 
						||
| 
								 | 
							
								select "Test  'go' command \g" as "_";
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "select * from t1\g"
							 | 
						||
| 
								 | 
							
								--enable_query_log
							 | 
						||
| 
								 | 
							
								drop table t1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# BUG9998 - MySQL client hangs on USE "database"
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								create table t1(a int);
							 | 
						||
| 
								 | 
							
								lock tables t1 write;
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -e "use test; select database();"
							 | 
						||
| 
								 | 
							
								unlock tables;
							 | 
						||
| 
								 | 
							
								drop table t1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug#16859 -- NULLs in columns must not truncate data as if a C-language "string".
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -t test -e "create table t1 (col1 binary(4), col2 varchar(10), col3 int); insert into t1 values ('a', 'b', 123421),('a ', '0123456789', 4), ('abcd', '', 4); select concat('>',col1,'<'), col2, col3 from t1; drop table t1;" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# 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
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# 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;"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# "DESCRIBE" commands may return strange NULLness flags.
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug#19564: mysql displays NULL instead of space
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;" 
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;" 
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug#21618: NULL shown as empty string in client
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "select unhex('zz');" 
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -t test -e "select unhex('zz');" 
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Bug#19265 describe command does not work from mysql prompt
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								create table t1(a int, b varchar(255), c int);
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "desc t1"
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "desc t1\g"
							 | 
						||
| 
								 | 
							
								drop table t1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--disable_parsing
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug#21042  	mysql client segfaults on importing a mysqldump export
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1
							 | 
						||
| 
								 | 
							
								--enable_parsing
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #20432: mysql client interprets commands in comments
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--let $file = $MYSQLTEST_VARDIR/tmp/bug20432.sql
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# if the client sees the 'use' within the comment, we haven't fixed
							 | 
						||
| 
								 | 
							
								--exec echo "/*"          >  $file
							 | 
						||
| 
								 | 
							
								--exec echo "use"         >> $file
							 | 
						||
| 
								 | 
							
								--exec echo "*/"          >> $file
							 | 
						||
| 
								 | 
							
								--exec $MYSQL              < $file 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# SQL can have embedded comments => workie
							 | 
						||
| 
								 | 
							
								--exec echo "select /*"   >  $file
							 | 
						||
| 
								 | 
							
								--exec echo "use"         >> $file
							 | 
						||
| 
								 | 
							
								--exec echo "*/ 1"        >> $file
							 | 
						||
| 
								 | 
							
								--exec $MYSQL              < $file 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# client commands on the other hand must be at BOL => error
							 | 
						||
| 
								 | 
							
								--exec echo "/*"          >  $file
							 | 
						||
| 
								 | 
							
								--exec echo "xxx"         >> $file
							 | 
						||
| 
								 | 
							
								--exec echo "*/ use"      >> $file
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL              < $file 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# client comment recognized, but parameter missing => error
							 | 
						||
| 
								 | 
							
								--exec echo "use"         >  $file
							 | 
						||
| 
								 | 
							
								--exec $MYSQL              < $file 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--remove_file $file
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #20328: mysql client interprets commands in comments
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--let $file1 = $MYSQLTEST_VARDIR/tmp/bug20328_1.result
							 | 
						||
| 
								 | 
							
								--let $file2 = $MYSQLTEST_VARDIR/tmp/bug20328_2.result
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -e "help" > $file1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -e "help " > $file2
							 | 
						||
| 
								 | 
							
								--diff_files $file1 $file2
							 | 
						||
| 
								 | 
							
								--remove_file $file1
							 | 
						||
| 
								 | 
							
								--remove_file $file2
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #19216: Client crashes on long SELECT
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Create large SELECT
							 | 
						||
| 
								 | 
							
								# - 3400 * 20 makes 68000 columns that is more than the
							 | 
						||
| 
								 | 
							
								#   max number that can fit in a 16 bit number.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--perl
							 | 
						||
| 
								 | 
							
								open(FILE,">","$ENV{'MYSQLTEST_VARDIR'}/tmp/b19216.tmp") or die;
							 | 
						||
| 
								 | 
							
								print FILE "select\n";
							 | 
						||
| 
								 | 
							
								print FILE "'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',\n" x 3400;
							 | 
						||
| 
								 | 
							
								print FILE "'b';\n";
							 | 
						||
| 
								 | 
							
								close FILE;
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--disable_query_log
							 | 
						||
| 
								 | 
							
								--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/b19216.tmp >/dev/null
							 | 
						||
| 
								 | 
							
								--enable_query_log
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--remove_file $MYSQLTEST_VARDIR/tmp/b19216.tmp
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #20103: Escaping with backslash does not work
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--let $file = $MYSQLTEST_VARDIR/tmp/bug20103.sql
							 | 
						||
| 
								 | 
							
								--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';"  > $file
							 | 
						||
| 
								 | 
							
								--exec echo "SELECT '\';" >> $file
							 | 
						||
| 
								 | 
							
								--exec $MYSQL < $file 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--exec echo "SET SQL_MODE = '';"  > $file
							 | 
						||
| 
								 | 
							
								--exec echo "SELECT '\';';" >> $file
							 | 
						||
| 
								 | 
							
								--exec $MYSQL              < $file 2>&1
							 | 
						||
| 
								 | 
							
								--remove_file $file
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug#17583: mysql drops connection when stdout is not writable
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								create table t17583 (a int);
							 | 
						||
| 
								 | 
							
								insert into t17583 (a) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
							 | 
						||
| 
								 | 
							
								insert into t17583 select a from t17583;
							 | 
						||
| 
								 | 
							
								insert into t17583 select a from t17583;
							 | 
						||
| 
								 | 
							
								insert into t17583 select a from t17583;
							 | 
						||
| 
								 | 
							
								insert into t17583 select a from t17583;
							 | 
						||
| 
								 | 
							
								insert into t17583 select a from t17583;
							 | 
						||
| 
								 | 
							
								insert into t17583 select a from t17583;
							 | 
						||
| 
								 | 
							
								insert into t17583 select a from t17583;
							 | 
						||
| 
								 | 
							
								# Close to the minimal data needed to exercise bug.
							 | 
						||
| 
								 | 
							
								select count(*) from t17583;
							 | 
						||
| 
								 | 
							
								--exec echo "select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; " |$MYSQL test >&-
							 | 
						||
| 
								 | 
							
								drop table t17583;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug#20984: Reproducible MySQL client segmentation fault
							 | 
						||
| 
								 | 
							
								#  + additional tests for the "com_connect" function in mysql
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--echo Test connect without db- or host-name => reconnect
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "\r" 2>&1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "connect" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo Test connect with dbname only => new dbname, old hostname
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "\r test" 2>&1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "connect test" 2>&1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "\rtest" 2>&1
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "connecttest" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo Test connect with _invalid_ dbname only => new invalid dbname, old hostname
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "\r invalid" 2>&1
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "connect invalid" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo Test connect with dbname + hostname
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "\r test localhost" 2>&1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "connect test localhost" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo Test connect with dbname + _invalid_ hostname
							 | 
						||
| 
								 | 
							
								# Mask the errno of the error message
							 | 
						||
| 
								 | 
							
								--replace_regex /\([0-9]*\)/(errno)/
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "\r test invalid_hostname" 2>&1
							 | 
						||
| 
								 | 
							
								--replace_regex /\([0-9]*\)/(errno)/
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "connect test invalid_hostname" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo The commands reported in the bug report
							 | 
						||
| 
								 | 
							
								--replace_regex /\([0-9]*\)/(errno)/
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#--replace_regex /\([0-9]*\)/(errno)/
							 | 
						||
| 
								 | 
							
								#--error 1
							 | 
						||
| 
								 | 
							
								#--exec echo '\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | $MYSQL 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo Too long dbname
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "\r test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx localhost" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo Too long hostname
							 | 
						||
| 
								 | 
							
								--replace_regex /\([0-9]*\)/(errno)/
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "\r  test cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #21412: mysql cmdline client allows backslash(es) 
							 | 
						||
| 
								 | 
							
								# as delimiter but can't recognize them
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# This should work just fine...
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
							 | 
						||
| 
								 | 
							
								DELIMITER /
							 | 
						||
| 
								 | 
							
								SELECT 1/
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
							 | 
						||
| 
								 | 
							
								remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# This should give an error...
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
							 | 
						||
| 
								 | 
							
								DELIMITER \
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
							 | 
						||
| 
								 | 
							
								remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# As should this...
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
							 | 
						||
| 
								 | 
							
								DELIMITER \\
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
							 | 
						||
| 
								 | 
							
								remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Some coverage of not normally used parts
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--disable_query_log
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "show status" 2>&1 > /dev/null
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --help 2>&1 > /dev/null
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --version 2>&1 > /dev/null
							 | 
						||
| 
								 | 
							
								--enable_query_log
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# bug #26851: Mysql Client --pager Buffer Overflow
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# allow error 7(invalid argument) since --pager does not always exist in mysql
							 | 
						||
| 
								 | 
							
								--error 0,7
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --pager="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" > /dev/null 2>&1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --character-sets-dir="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# bug #30164: Using client side macro inside server side comments generates broken queries
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "/*! \C latin1 */ select 1;"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug#29323 mysql client only accetps ANSI encoded files
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/bug29323.sql
							 | 
						||
| 
								 | 
							
								select "This is a file starting with UTF8 BOM 0xEFBBBF";
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
							 | 
						||
| 
								 | 
							
								remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #33812: mysql client incorrectly parsing DELIMITER
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# The space and ; after delimiter are important
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -e "select 1 delimiter ;"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #38158: mysql client regression, can't read dump files
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/bug38158.sql
							 | 
						||
| 
								 | 
							
								-- Testing
							 | 
						||
| 
								 | 
							
								--
							 | 
						||
| 
								 | 
							
								delimiter ||
							 | 
						||
| 
								 | 
							
								select 2 ||
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
							 | 
						||
| 
								 | 
							
								remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #41437: Value stored in 'case' lacks charset, causees segfault
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -e "select @z:='1',@z=database()"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #31060: MySQL CLI parser bug 2
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/bug31060.sql
							 | 
						||
| 
								 | 
							
								;DELIMITER DELIMITER
							 | 
						||
| 
								 | 
							
								;
							 | 
						||
| 
								 | 
							
								SELECT 1DELIMITER
							 | 
						||
| 
								 | 
							
								DELIMITER ;
							 | 
						||
| 
								 | 
							
								SELECT 1;
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug31060.sql 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #39101: client -i (--ignore-spaces) option does not seem to work
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -i -e "SELECT COUNT (*)"
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --ignore-spaces -e "SELECT COUNT (*)"
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -b -i -e "SELECT COUNT (*)"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug#37268 'binary' character set makes CLI-internal commands case sensitive
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--replace_regex /\([0-9]*\)/(errno)/
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --default-character-set=binary test -e "CONNECT test invalid_hostname" 2>&1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --default-character-set=binary test -e "DELIMITER //" 2>&1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo End of 5.0 tests
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #29903: The CMake build method does not produce the embedded library.
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--disable_query_log
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --server-arg=no-defaults test -e "quit"
							 | 
						||
| 
								 | 
							
								--enable_query_log
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #25146: Some warnings/errors not shown when using --show-warnings
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# This one should succeed with no warnings
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --show-warnings test -e "create table t1 (id int)"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# This should succeed, with warnings about conversion from nonexistent engine
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --show-warnings test -e "create table t2 (id int) engine=nonexistent"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# This should fail, with warnings as well
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --show-warnings test -e "create table t2 (id int) engine=nonexistent2"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								drop tables t1, t2;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #27884: mysql --html does not quote HTML special characters in output
							 | 
						||
| 
								 | 
							
								# 
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/bug27884.sql
							 | 
						||
| 
								 | 
							
								SELECT '< & >' AS `<`;
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --html test < $MYSQLTEST_VARDIR/tmp/bug27884.sql
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								remove_file $MYSQLTEST_VARDIR/tmp/bug27884.sql;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #28203: mysql client + null byte
							 | 
						||
| 
								 | 
							
								# 
							 | 
						||
| 
								 | 
							
								create table t1 (a char(5));
							 | 
						||
| 
								 | 
							
								insert into t1 values ('\0b\0');
							 | 
						||
| 
								 | 
							
								--exec $MYSQL test -e "select a from t1"
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -r test -e "select a from t1"
							 | 
						||
| 
								 | 
							
								--exec $MYSQL -s test -e "select a from t1"
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --table test -e "select a from t1"
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --vertical test -e "select a from t1"
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --html test -e "select a from t1"
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --xml test -e "select a from t1"
							 | 
						||
| 
								 | 
							
								drop table t1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo
							 | 
						||
| 
								 | 
							
								--echo Bug #47147: mysql client option --skip-column-names does not apply to vertical output
							 | 
						||
| 
								 | 
							
								--echo
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --skip-column-names --vertical test -e "select 1 as a"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug#57450: mysql client enter in an infinite loop if the standard input is a directory
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--error 1
							 | 
						||
| 
								 | 
							
								--exec $MYSQL < .
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								--echo # Bug #54899: --one-database option cannot handle DROP/CREATE DATABASE 
							 | 
						||
| 
								 | 
							
								--echo #             commands.
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/bug54899.sql
							 | 
						||
| 
								 | 
							
								DROP DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								CREATE DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								USE connected_db;
							 | 
						||
| 
								 | 
							
								CREATE TABLE `table_in_connected_db`(a INT);
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CREATE DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/bug54899.sql
							 | 
						||
| 
								 | 
							
								USE connected_db;
							 | 
						||
| 
								 | 
							
								SHOW TABLES;
							 | 
						||
| 
								 | 
							
								DROP DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								--remove_file $MYSQLTEST_VARDIR/tmp/bug54899.sql
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								--echo # Testing --one-database option
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								CREATE TABLE t1 (i INT);
							 | 
						||
| 
								 | 
							
								CREATE TABLE test.t1 (i INT);
							 | 
						||
| 
								 | 
							
								USE test;
							 | 
						||
| 
								 | 
							
								# Following statements should be filtered.
							 | 
						||
| 
								 | 
							
								CREATE TABLE connected_db.t2 (i INT);
							 | 
						||
| 
								 | 
							
								CREATE TABLE t2 (i INT);
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CREATE DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								SHOW TABLES IN connected_db;
							 | 
						||
| 
								 | 
							
								SHOW TABLES IN test;
							 | 
						||
| 
								 | 
							
								USE test;
							 | 
						||
| 
								 | 
							
								DROP TABLE t1;
							 | 
						||
| 
								 | 
							
								DROP DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								CREATE DATABASE test1;
							 | 
						||
| 
								 | 
							
								USE test1;
							 | 
						||
| 
								 | 
							
								USE test1;
							 | 
						||
| 
								 | 
							
								# Following statements should be filtered.
							 | 
						||
| 
								 | 
							
								CREATE TABLE connected_db.t1 (i INT);
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --one-database test < $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								SHOW TABLES IN test;
							 | 
						||
| 
								 | 
							
								SHOW TABLES IN test1;
							 | 
						||
| 
								 | 
							
								DROP DATABASE test1;
							 | 
						||
| 
								 | 
							
								--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								--echo # Checking --one-database option followed by the execution of 
							 | 
						||
| 
								 | 
							
								--echo # connect command.
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								CREATE TABLE t1 (i INT);
							 | 
						||
| 
								 | 
							
								CREATE TABLE test.t1 (i INT);
							 | 
						||
| 
								 | 
							
								CONNECT test;
							 | 
						||
| 
								 | 
							
								CREATE TABLE connected_db.t2 (i INT);
							 | 
						||
| 
								 | 
							
								CREATE TABLE t2 (i INT);
							 | 
						||
| 
								 | 
							
								USE connected_db;
							 | 
						||
| 
								 | 
							
								# Following statements should be filtered.
							 | 
						||
| 
								 | 
							
								CREATE TABLE connected_db.t3 (i INT);
							 | 
						||
| 
								 | 
							
								CREATE TABLE t3 (i INT);
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CREATE DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								SHOW TABLES IN connected_db;
							 | 
						||
| 
								 | 
							
								SHOW TABLES IN test;
							 | 
						||
| 
								 | 
							
								DROP TABLE test.t1;
							 | 
						||
| 
								 | 
							
								DROP TABLE test.t2;
							 | 
						||
| 
								 | 
							
								DROP DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								--echo # Checking --one-database option with no database specified
							 | 
						||
| 
								 | 
							
								--echo # at command-line.
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								# All following statements should be filtered.
							 | 
						||
| 
								 | 
							
								CREATE TABLE t1 (i INT);
							 | 
						||
| 
								 | 
							
								CREATE TABLE test.t1 (i INT);
							 | 
						||
| 
								 | 
							
								USE test;
							 | 
						||
| 
								 | 
							
								CREATE TABLE test.t2 (i INT);
							 | 
						||
| 
								 | 
							
								CREATE TABLE t2 (i INT);
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --one-database < $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								SHOW TABLES IN test;
							 | 
						||
| 
								 | 
							
								--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								--echo # Checking --one-database option with non_existent_db 
							 | 
						||
| 
								 | 
							
								--echo # specified with USE command
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# CASE 1 : When 'connected_db' database exists and passed at commandline.
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql
							 | 
						||
| 
								 | 
							
								CREATE TABLE `table_in_connected_db`(i INT);
							 | 
						||
| 
								 | 
							
								USE non_existent_db;
							 | 
						||
| 
								 | 
							
								# Following statement should be filtered out.
							 | 
						||
| 
								 | 
							
								CREATE TABLE `table_in_non_existent_db`(i INT);
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# CASE 2 : When 'connected_db' database exists but dropped and recreated in
							 | 
						||
| 
								 | 
							
								# load file.
							 | 
						||
| 
								 | 
							
								--write_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql
							 | 
						||
| 
								 | 
							
								DROP DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								CREATE DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								USE non_existent_db;
							 | 
						||
| 
								 | 
							
								# Following statements should be filtered out.
							 | 
						||
| 
								 | 
							
								CREATE TABLE `table_in_non_existent_db`(i INT);
							 | 
						||
| 
								 | 
							
								USE connected_db;
							 | 
						||
| 
								 | 
							
								# Following statements should not be filtered out.
							 | 
						||
| 
								 | 
							
								CREATE TABLE `table_in_connected_db`(i INT);
							 | 
						||
| 
								 | 
							
								EOF
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CREATE DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db_1.sql
							 | 
						||
| 
								 | 
							
								SHOW TABLES IN connected_db;
							 | 
						||
| 
								 | 
							
								--echo
							 | 
						||
| 
								 | 
							
								--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db_2.sql
							 | 
						||
| 
								 | 
							
								SHOW TABLES IN connected_db;
							 | 
						||
| 
								 | 
							
								DROP DATABASE connected_db;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--remove_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql
							 | 
						||
| 
								 | 
							
								--remove_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo
							 | 
						||
| 
								 | 
							
								--echo End of tests
							 |