MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
partition_layout_check1.inc
1 ################################################################################
2 # inc/partition_layout_check1.inc #
3 # #
4 # Purpose: #
5 # Store the SHOW CREATE TABLE output and the list of files belonging to #
6 # this table + print this into the protocol #
7 # This script is only usefule when sourced within the partitioning tests. #
8 # #
9 # Attention: The routine inc/partition_layout_check2.inc is very similar #
10 # to this one. So if something has to be changed here it #
11 # might be necessary to do it also there #
12 # #
13 #------------------------------------------------------------------------------#
14 # Original Author: mleich #
15 # Original Date: 2006-03-05 #
16 # Change Author: pcrews #
17 # Change Date: 2008-04-15 #
18 # Change: Added --replace_result to account for Windows' use of '\r' #
19 ################################################################################
20 
21 if ($no_debug)
22 {
23 --disable_query_log
24 }
25 # Clean the table holding the definition of t1
26 DELETE FROM t0_definition;
27 
28 # Get the MySQL Servers datadir without ending slash
29 let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`;
30 #echo MYSQLD_DATADIR: $MYSQLD_DATADIR;
31 
32 # Save the current definition of the table t1
33 # - SHOW CREATE TABLE t1 is at least currently most probably more reliable than
34 # the corresponding SELECT on the INFORMATION_SCHEMA
35 let $show_create= `SHOW CREATE TABLE t1`;
36 if ($do_file_tests)
37 {
38  # List the files belonging to the table t1
39  let $ls_file= $MYSQLD_DATADIR/test/tmp2;
40  --list_files_write_file $ls_file $MYSQLD_DATADIR/test t1*
41  --chmod 0644 $ls_file
42  if ($with_directories)
43  {
44  --list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-data-dir t1*
45  --list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1*
46  }
47  eval SET @aux = load_file('$ls_file');
48 
49  # clean up
50  --remove_file $ls_file
51 }
52 if (!$do_file_tests)
53 {
54  SET @aux = '--- not determined ---';
55 }
56 
57 # Insert the current definition of the table t1 into t0_definition
58 eval INSERT INTO t0_definition SET state = 'old',
59  create_command = "$show_create",
60  file_list = @aux;
61 
62 # Print the create table statement into the protocol
63 # Added the concat to avoid changing the result files
64 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR '\r' ''
65 SELECT concat('SHOW CREATE TABLE t1;\nTable\tCreate Table\n',create_command,'\n') as `create_command` FROM t0_definition WHERE state = 'old';
66 if ($do_file_tests)
67 {
68  # We stored the list of files, therefore printing the content makes sense
69  if ($ls)
70  {
71  # Print the list of files into the protocol
72  replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR #p# #P# #sp# #SP# part_n part_N;
73  SELECT file_list AS "unified filelist"
74  FROM t0_definition WHERE state = 'old';
75  }
76 }
77 --enable_query_log