MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mysqldump.inc
1 ################################################################################
2 # mysqldump.inc
3 #
4 # SUMMARY: include file to facilitate testing the quality of mysqldump output
5 #
6 # INPUTS: Two variables:
7 # $table_name - the name of the table that was dumped
8 # $mysqldumpfile - the name of the file that captured mysqldump output
9 #
10 # OUTPUTS: minor echo data:
11 # We 'echo' some stage information to the .result file:
12 # 'altering original table', 'restoring from dumpfile', 'comparing'
13 #
14 # OTHER FILES: We use include/diff_tables.inc to compare the original, renamed
15 # table with the 'restored' one.
16 #
17 # DESCRIPTION: This file works by being fed the name of the original table
18 # and a mysqldump output file. The original table is then renamed
19 # to <table_name>_orig, the mysqldump file is used to recreate the
20 # table, then diff_tables.inc is called to compare them.
21 #
22 # LIMITATIONS: Does *NOT* work with xml output!
23 #
24 # AUTHOR: pcrews 2009-05-21
25 # Bug#40465 mysqldump.test does no checking of dump or restore
26 #
27 # LAST CHANGE: 2009-05-21
28 #
29 ################################################################################
30 
31 --echo # Begin testing mysqldump output + restore
32 --echo # Create 'original table name - <table>_orig
33 # NOTE: We use SET then let as query_get_value has issues with the extra commas
34 # used in the CONCAT statement.
35 eval SET @orig_table_name = CONCAT('$table_name', '_orig');
36 let $orig_table_name = query_get_value(SELECT @orig_table_name,@orig_table_name,1);
37 --echo # Rename original table
38 eval ALTER TABLE $table_name RENAME to $orig_table_name;
39 --echo # Recreate table from mysqldump output
40 --exec $MYSQL test < $mysqldumpfile
41 --echo # Compare original and recreated tables
42 --echo # Recreated table: $table_name
43 --echo # Original table: $orig_table_name
44 let $diff_tables = $table_name, $orig_table_name;
45 --source include/diff_tables.inc
46 --echo # Cleanup
47 --remove_file $mysqldumpfile
48 eval DROP TABLE $table_name, $orig_table_name;
49