1543.1.2
by patrick crews
Incorporated review feedback and deleted unused code from diff_tables.inc. Also fixed omission of the new include, test, and result files |
1 |
################################################################################
|
2 |
# drizzledump.inc |
|
3 |
#
|
|
4 |
# SUMMARY: include file to facilitate testing the quality of drizzledump output |
|
5 |
#
|
|
6 |
# INPUTS: Two variables: |
|
7 |
# $table_name - the name of the table that was dumped |
|
8 |
# $drizzledumpfile - the name of the file that captured drizzledump 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 drizzledump output file. The original table is then renamed |
|
19 |
# to <table_name>_orig, the drizzledump 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 |
################################################################################
|
|
25 |
||
26 |
--echo # Begin testing drizzledump output + restore |
|
27 |
--echo # Create 'original table name - <table>_orig |
|
28 |
# NOTE: We use SET then let as query_get_value has issues with the extra commas |
|
29 |
# used in the CONCAT statement. |
|
30 |
eval SET @orig_table_name = CONCAT('$table_name', '_orig'); |
|
31 |
let $orig_table_name = query_get_value(SELECT @orig_table_name,@orig_table_name,1); |
|
32 |
--echo # Rename original table |
|
33 |
eval ALTER TABLE $table_name RENAME to $orig_table_name; |
|
34 |
--echo # Recreate table from drizzledump output |
|
35 |
--exec $DRIZZLE test < $drizzledumpfile |
|
36 |
--echo # Compare original and recreated tables |
|
37 |
--echo # Recreated table: $table_name |
|
38 |
--echo # Original table: $orig_table_name |
|
39 |
let $diff_table_1 = $table_name; |
|
40 |
let $diff_table_2 = $orig_table_name; |
|
41 |
--source include/diff_tables.inc |
|
42 |
--echo # Cleanup |
|
43 |
--remove_file $drizzledumpfile |
|
44 |
eval DROP TABLE $table_name, $orig_table_name; |
|
45 |