... | ... |
@@ -300,21 +300,27 @@ sub each_column { |
300 | 300 |
else { |
301 | 301 |
my $re = $self->exclude_table || $options{exclude_table}; |
302 | 302 |
# Tables |
303 |
- my %tables; |
|
304 |
- $self->each_table(sub { $tables{$_[1]}++ }); |
|
303 |
+ my $tables = {}; |
|
304 |
+ $self->each_table(sub { |
|
305 |
+ my ($dbi, $table, $table_info) = @_; |
|
306 |
+ my $schema = $table_info->{TABLE_SCHEM}; |
|
307 |
+ |
|
308 |
+ $tables->{$schema}{$table}++; |
|
309 |
+ }); |
|
305 | 310 |
|
306 | 311 |
# Iterate all tables |
307 |
- my @tables = sort keys %tables; |
|
308 |
- for (my $i = 0; $i < @tables; $i++) { |
|
309 |
- my $table = $tables[$i]; |
|
310 |
- |
|
311 |
- # Iterate all columns |
|
312 |
- my $sth_columns; |
|
313 |
- eval {$sth_columns = $self->dbh->column_info(undef, undef, $table, '%')}; |
|
314 |
- next if $@; |
|
315 |
- while (my $column_info = $sth_columns->fetchrow_hashref) { |
|
316 |
- my $column = $column_info->{COLUMN_NAME}; |
|
317 |
- $self->$cb($table, $column, $column_info); |
|
312 |
+ for my $schema (sort keys %$tables) { |
|
313 |
+ for my $table (sort keys %{$tables->{$schema}}) { |
|
314 |
+ |
|
315 |
+ # Iterate all columns |
|
316 |
+ my $sth_columns; |
|
317 |
+ eval {$sth_columns = $self->dbh->column_info(undef, $schema, $table, '%')}; |
|
318 |
+ next if $@; |
|
319 |
+ while (my $column_info = $sth_columns->fetchrow_hashref) { |
|
320 |
+ $DB::single = 1; |
|
321 |
+ my $column = $column_info->{COLUMN_NAME}; |
|
322 |
+ $self->$cb($table, $column, $column_info); |
|
323 |
+ } |
|
318 | 324 |
} |
319 | 325 |
} |
320 | 326 |
} |
... | ... |
@@ -1211,7 +1217,7 @@ sub type_rule { |
1211 | 1217 |
|
1212 | 1218 |
$filter = $self->filters->{$fname}; |
1213 | 1219 |
} |
1214 |
- |
|
1220 |
+ |
|
1215 | 1221 |
my $database = $column_info->{TABLE_SCHEM}; |
1216 | 1222 |
$self->{"_$into"}{key}{$table}{$column} = $filter; |
1217 | 1223 |
$self->{"_$into"}{dot}{"$table.$column"} = $filter; |