Revision history for Perl extension DBIx::Class::Schema::Loader
+ - fix is_nullable detection on MS Access
- remove '$table has no primary key' warning
- added uniq_to_primary option to promote unique keys to primary keys
(RT#25944)
while (my ($col, $info) = each %$result) {
my $data_type = $info->{data_type};
- my $col_obj;
-
- my $cols = $self->_adox_catalog->Tables->Item($table)->Columns;
-
- for my $col_idx (0..$cols->Count-1) {
- $col_obj = $cols->Item($col_idx);
- if ($self->preserve_case) {
- last if $col_obj->Name eq $col;
- }
- else {
- last if lc($col_obj->Name) eq lc($col);
- }
- }
-
- if ($col_obj->Attributes | 2 == 2) {
- $info->{is_nullable} = 1;
- }
+ my $col_obj = $self->_adox_column($table, $col);
if ($data_type eq 'long') {
$info->{data_type} = 'integer';
$info->{data_type} = 'binary';
last;
}
-
}
$info->{size} = $col_obj->DefinedSize;
return $cat;
}
+sub _adox_column {
+ my ($self, $table, $col) = @_;
+
+ my $col_obj;
+
+ my $cols = $self->_adox_catalog->Tables->Item($table)->Columns;
+
+ for my $col_idx (0..$cols->Count-1) {
+ $col_obj = $cols->Item($col_idx);
+ if ($self->preserve_case) {
+ last if $col_obj->Name eq $col;
+ }
+ else {
+ last if lc($col_obj->Name) eq lc($col);
+ }
+ }
+
+ return $col_obj;
+}
+
sub rescan {
my $self = shift;
while (my ($col, $info) = each %$result) {
my $data_type = $info->{data_type};
+ my $col_obj = $self->_adox_column($table, $col);
+
+ $info->{is_nullable} = ($col_obj->Attributes & 2) == 2 ? 1 : 0;
+
if ($data_type eq 'counter') {
$info->{data_type} = 'integer';
$info->{is_auto_increment} = 1;
$num_rescans++ if $self->{vendor} eq 'Firebird';
plan tests => @connect_info *
- (207 + $num_rescans * $col_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0));
+ (209 + $num_rescans * $col_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0));
foreach my $info_idx (0..$#connect_info) {
my $info = $connect_info[$info_idx];
is( $class2->column_info('crumb_crisp_coating')->{accessor}, 'trivet',
'col_accessor_map is being run' );
+ is $class1->column_info('dat')->{is_nullable}, 0,
+ 'is_nullable=0 detection';
+
+ is $class2->column_info('set_primary_key')->{is_nullable}, 1,
+ 'is_nullable=1 detection';
+
SKIP: {
skip $self->{skip_rels}, 131 if $self->{skip_rels};