my $extra_count = $self->{extra}{count} || 0;
- plan tests => @connect_info * (174 + $extra_count + ($self->{data_type_tests}{test_count} || 0));
+ plan tests => @connect_info * (176 + $extra_count + ($self->{data_type_tests}{test_count} || 0));
foreach my $info_idx (0..$#connect_info) {
my $info = $connect_info[$info_idx];
$self->drop_extra_tables_only;
my $dbh = $self->dbconnect(1);
- $dbh->do($_) for @{ $self->{extra}{create} || [] };
- $dbh->do($self->{data_type_tests}{ddl}) if $self->{data_type_tests}{ddl};
+ {
+ # Silence annoying but harmless postgres "NOTICE: CREATE TABLE..."
+ local $SIG{__WARN__} = sub {
+ my $msg = shift;
+ warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
+ };
+
+
+ $dbh->do($_) for @{ $self->{extra}{create} || [] };
+ $dbh->do($self->{data_type_tests}{ddl}) if $self->{data_type_tests}{ddl};
+ }
$self->{_created} = 1;
my $file_count = grep /CREATE (?:TABLE|VIEW)/i, @{ $self->{extra}{create} || [] };
isa_ok( $rsobj35, "DBIx::Class::ResultSet" );
my @columns_lt2 = $class2->columns;
- is_deeply( \@columns_lt2, [ qw/id dat dat2/ ], "Column Ordering" );
+ is_deeply( \@columns_lt2, [ qw/id dat dat2 set_primary_key dbix_class_testcomponent/ ], "Column Ordering" );
+
+ is $class2->column_info('set_primary_key')->{accessor}, undef,
+ 'accessor for column name that conflicts with a result base class method removed';
+
+ is $class2->column_info('dbix_class_testcomponent')->{accessor}, undef,
+ 'accessor for column name that conflicts with a component class method removed';
my %uniq1 = $class1->unique_constraints;
my $uniq1_test = 0;
# Silence annoying but harmless postgres "NOTICE: CREATE TABLE..."
local $SIG{__WARN__} = sub {
my $msg = shift;
- print STDERR $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
+ warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
};
$dbh->do($_) for @statements_rescan;
q{ INSERT INTO loader_test1s (dat) VALUES('bar') },
q{ INSERT INTO loader_test1s (dat) VALUES('baz') },
+ # also test method collision
qq{
CREATE TABLE loader_test2 (
id $self->{auto_inc_pk},
dat VARCHAR(32) NOT NULL,
dat2 VARCHAR(32) NOT NULL,
+ set_primary_key INTEGER $self->{null},
+ dbix_class_testcomponent INTEGER $self->{null},
UNIQUE (dat2, dat)
) $self->{innodb}
},
# Silence annoying but harmless postgres "NOTICE: CREATE TABLE..."
local $SIG{__WARN__} = sub {
my $msg = shift;
- print STDERR $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
+ warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
};
$dbh->do($_) for (@statements);
$size =~ s/\s+//g;
my @size = split /,/, $size;
- # Firebird doesn't like very long column names
- if ($self->{vendor} =~ /^firebird\z/i) {
- $type_alias =~ s/default\b.*/_with_dflt/i;
+ # some DBs don't like very long column names
+ if ($self->{vendor} =~ /^firebird|sqlanywhere\z/i) {
+ my ($col_def, $default) = $type_alias =~ /^(.*)(default.*)?\z/i;
+
+ $type_alias = substr $col_def, 0, 15;
+
+ $type_alias .= '_with_dflt' if $default;
}
$type_alias =~ s/\s/_/g;
if (@size) {
my $size_name = join '_', apply { s/\W//g } @size;
- $col_name .= "_with_size_$size_name";
+ $col_name .= "_sz_$size_name";
}
$col_name .= "_$seen_col_names{$col_name}" if $seen_col_names{$col_name}++;