Showing 2 changed files with 7 additions and 7 deletions
+7 -6
lib/DBIx/Custom.pm
... ...
@@ -317,6 +317,7 @@ sub each_column {
317 317
         eval {$sth_columns = $self->dbh->column_info(undef, $schema, $table, '%')};
318 318
         next if $@;
319 319
         while (my $column_info = $sth_columns->fetchrow_hashref) {
320
+          $DB::single = 1;
320 321
           my $column = $column_info->{COLUMN_NAME};
321 322
           $self->$cb($table, $column, $column_info);
322 323
         }
... ...
@@ -1126,10 +1127,10 @@ sub setup_model {
1126 1127
   $self->each_column(
1127 1128
     sub {
1128 1129
       my ($self, $table, $column, $column_info) = @_;
1129
-      my $database = $column_info->{TABLE_SCHEM};
1130
-      return if exists $opt{database} && $opt{database} ne $database;
1130
+      my $schema = $column_info->{TABLE_SCHEM};
1131
+      return if exists $opt{database} && $opt{database} ne $schema;
1131 1132
       
1132
-      $table = "$database.$table" if exists $opt{prefix};
1133
+      $table = "$schema.$table" if exists $opt{prefix};
1133 1134
       if (my $model = $self->models->{$table}) {
1134 1135
         push @{$model->columns}, $column;
1135 1136
       }
... ...
@@ -1217,11 +1218,11 @@ sub type_rule {
1217 1218
             $filter = $self->filters->{$fname};
1218 1219
           }
1219 1220
           
1220
-          my $database = $column_info->{TABLE_SCHEM};
1221
+          my $schema = $column_info->{TABLE_SCHEM};
1221 1222
           $self->{"_$into"}{key}{$table}{$column} = $filter;
1222 1223
           $self->{"_$into"}{dot}{"$table.$column"} = $filter;
1223
-          $self->{"_$into"}{key}{"$database.$table"}{$column} = $filter;
1224
-          $self->{"_$into"}{dot}{"$database.$table.$column"} = $filter;
1224
+          $self->{"_$into"}{key}{"$schema.$table"}{$column} = $filter;
1225
+          $self->{"_$into"}{dot}{"$schema.$table.$column"} = $filter;
1225 1226
         }
1226 1227
       });
1227 1228
     }
-1
t/common.t
... ...
@@ -3961,7 +3961,6 @@ $dbi->setup_model(@$setup_model_args);
3961 3961
 $dbi->execute("insert into $table1 ($key1, $key2) values (1, 2)");
3962 3962
 $dbi->execute("insert into $table2 ($key1, $key3) values (1, 4)");
3963 3963
 $model = $dbi->model($table1);
3964
-$DB::single = 1;
3965 3964
 $result = $model->select(
3966 3965
   column => [
3967 3966
     $model->column($table2, {alias => u$table2_alias})