This file is indexed.

/usr/lib/mysql-testsuite/t/mysql.test is in mysql-testsuite-5.6 5.6.16-1~exp1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
# 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
#
--character_set utf8
--execw $MYSQL --default-character-set=utf8 --table -e "SELECT 'John Doe' as '__tañgè Ñãmé'" 2>&1
--execw $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
#
--execw $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#26780: patch to add auto vertical output option to the cli.
#
# Make this wide enough that it will wrap almost everywhere.
--exec $MYSQL test --auto-vertical-output --table -e "SELECT 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0;"
# Too short to wrap.
--exec $MYSQL test --auto-vertical-output --table -e "SELECT 1;"

#
# Bug #25146: Some warnings/errors not shown when using --show-warnings
#

SET @@global.sql_mode='';

# 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;

SET @@global.sql_mode=DEFAULT;

#
# mysql client with 'init-command' option
#
--exec $MYSQL --init-command="SET lc_messages=ru_RU" -e "SHOW VARIABLES LIKE 'lc_messages';"

#
# 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

#
# WL#3126 TCP address binding for mysql client library;
# - running mysql --protocol=tcp --bind-address=127.0.0.1
#
--exec $MYSQL --protocol=tcp --bind-address=127.0.0.1 -e "select 1 as Connected"

--echo #
--echo # Bug#12688860 : SECURITY RECOMMENDATION: PASSWORDS ON CLI
--echo #

--exec $MYSQL -uroot --password="" -e "SELECT 1" 2>&1
# This too should throw single warning message.
--exec $MYSQL -uroot --password="" --password="" -e "SELECT 1" 2>&1

--echo
--echo End of tests