~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/include/diff_tables.inc

Merge Patrick

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
    --die
92
92
  }
93
93
 
94
 
  # NOTE:  We disable this ORDERING bit as it 
95
 
  # was causing fits for drizzledump_restore.test
96
 
  # The returned ORDINAL_POSITION value was 0 instead of 1 as we
97
 
  # expect in MySQL and things didn't work out
98
 
  # As the only test that uses this include file is
99
 
  # drizzledump_restore, it doesn't cause any problems
100
 
  # Leaving the code here at the moment in case someone should need
101
 
  # it, but recommend removing this entirely ~1 year from commit
102
 
  # date - 19 May 2010
103
 
 
104
 
  # We need the output files to be sorted (so that diff_files does not
105
 
  # think the files are different just because they are differently
106
 
  # ordered).  To this end, we first generate a query that sorts the
107
 
  # table by all columns.  Since ORDER BY accept column indices, we
108
 
  # just generate a comma-separated list of all numbers from 1 to the
109
 
  # number of columns in the table.
110
 
  let $_diff_column_index=`SELECT MAX(ordinal_position)
111
 
                           FROM data_dictionary.columns
112
 
                           WHERE CONCAT(table_schema, '.', table_name) =
113
 
                                 '$_diff_table'`;
114
 
 
115
 
  # The content of $_diff_column_index must be an integer >= 0.
116
 
  # If not the following might happen:
117
 
  # Result of SELECT | $_diff_column_index | dec $_diff_column_index
118
 
  #    NULL          | empty string        | -1
119
 
  #    ''            | empty string        | -1
120
 
  #    'a1'          | a1                  | -1
121
 
  #    '1a'          | 1a                  |  0
122
 
  #    ........................
123
 
  # (Bug#51057 Weak code in diff_tables.inc can lead to 100% CPU consumption)
124
 
  # In case $i = 1 the soone following loop
125
 
  # while ($i) {
126
 
  #   ...
127
 
  #   dec $i;
128
 
  # }
129
 
  # will never terminate.
130
 
  #if (`SELECT CAST(CAST('$_diff_column_index' AS UNSIGNED) AS CHAR(65))
131
 
  #            <> '$_diff_column_index'
132
 
  #         OR CAST('$_diff_column_index' AS UNSIGNED) < 1`) {
133
 
  #  --echo !!!ERROR IN TEST: \$_diff_column_index is '$_diff_column_index'
134
 
  #  --echo                   but must be an unsigned integer > 0
135
 
  #  --die
136
 
  #}
137
94
 
138
95
  #let $_diff_column_list=$_diff_column_index;
139
96
  #dec $_diff_column_index;