From: Rafael Kitover Date: Fri, 5 Mar 2010 21:28:22 +0000 (-0500) Subject: Oracle: works again. Firebird: better cleanup in common tests X-Git-Tag: 0.06000~62 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-Schema-Loader.git;a=commitdiff_plain;h=ffb03c967a65fa81a79b95d987e63dffd1ed6375 Oracle: works again. Firebird: better cleanup in common tests --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI.pm b/lib/DBIx/Class/Schema/Loader/DBI.pm index 99e2fbe..a9d7161 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI.pm @@ -48,8 +48,6 @@ sub new { # Set up the default quoting character and name seperators $self->{_quoter} = $self->_build_quoter; $self->{_namesep} = $self->_build_namesep; - $self->schema->storage->sql_maker->quote_char($self->{_quoter}); - $self->schema->storage->sql_maker->name_sep($self->{_namesep}); # For our usage as regex matches, concatenating multiple quoter # values works fine (e.g. s/\Q<>\E// if quoter was [ '<', '>' ]) diff --git a/lib/DBIx/Class/Schema/Loader/DBI/InterBase.pm b/lib/DBIx/Class/Schema/Loader/DBI/InterBase.pm index 69cfc15..c8c2fa6 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/InterBase.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/InterBase.pm @@ -23,6 +23,13 @@ See L for available options. sub _is_case_sensitive { 1 } +sub _setup { + my $self = shift; + + $self->schema->storage->sql_maker->quote_char('"'); + $self->schema->storage->sql_maker->name_sep('.'); +} + sub _table_pk_info { my ($self, $table) = @_; diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm index c6f78f9..c49e372 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -73,6 +73,7 @@ sub _tables_list { push @tables, $1 if $table =~ /\A(\w+)\z/; } + return $self->_filter_tables(@tables); } diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index 145e1db..896e2ad 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -30,7 +30,7 @@ sub new { # Only MySQL uses this $self->{innodb} ||= ''; - # DB2 doesn't support this + # DB2 and Firebird don't support 'field type NULL' $self->{null} = 'NULL' unless defined $self->{null}; $self->{verbose} = $ENV{TEST_VERBOSE} || 0; @@ -136,6 +136,8 @@ sub setup_schema { $loader_opts{db_schema} = $self->{db_schema} if $self->{db_schema}; + my $file_count; + my $expected_count = 36; { my @loader_warnings; local $SIG{__WARN__} = sub { push(@loader_warnings, $_[0]); }; @@ -149,11 +151,8 @@ sub setup_schema { ok(!$@, "Loader initialization") or diag $@; - my $file_count; find sub { return if -d; $file_count++ }, $DUMP_DIR; - my $expected_count = 36; - $expected_count += grep /CREATE (?:TABLE|VIEW)/i, @{ $self->{extra}{create} || [] }; @@ -168,8 +167,6 @@ sub setup_schema { is $file_count, $expected_count, 'correct number of files generated'; - exit if $file_count != $expected_count; - my $warn_count = 2; $warn_count++ if grep /ResultSetManager/, @loader_warnings; @@ -196,7 +193,9 @@ sub setup_schema { "Missing PK warning"); } } - + + exit if $file_count != $expected_count; + return $schema_class; } @@ -1399,8 +1398,8 @@ sub drop_tables { else { $dbh->do($drop_fk); } - $dbh->do("DROP TABLE $_") for (@tables_advanced); $dbh->do($_) for map { $drop_auto_inc->(@$_) } @tables_advanced_auto_inc; + $dbh->do("DROP TABLE $_") for (@tables_advanced); unless($self->{no_inline_rels}) { $dbh->do("DROP TABLE $_") for (@tables_inline_rels); @@ -1409,8 +1408,13 @@ sub drop_tables { $dbh->do("DROP TABLE $_") for (@tables_implicit_rels); } } - $dbh->do("DROP TABLE $_") for (@tables, @tables_rescan); $dbh->do($_) for map { $drop_auto_inc->(@$_) } @tables_auto_inc; + $dbh->do("DROP TABLE $_") for (@tables, @tables_rescan); + $dbh->disconnect; + +# fixup for Firebird + $dbh = $self->dbconnect(0); + $dbh->do('DROP TABLE loader_test2'); $dbh->disconnect; }