From: Dagfinn Ilmari Mannsåker Date: Sat, 29 Aug 2015 21:56:18 +0000 (+0100) Subject: Remove pointless options from _tables_list and _filter_tables X-Git-Tag: 0.07044~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5784b2b9d26d61b0673513413597fc5928e480a5;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Remove pointless options from _tables_list and _filter_tables _filter_tables can just get the constraints from $self instead --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 089adc0..3b14622 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -1623,9 +1623,7 @@ Does the actual schema-construction work. sub load { my $self = shift; - $self->_load_tables( - $self->_tables_list({ constraint => $self->constraint, exclude => $self->exclude }) - ); + $self->_load_tables($self->_tables_list); } =head2 rescan @@ -1647,7 +1645,7 @@ sub rescan { $self->_relbuilder->{schema} = $schema; my @created; - my @current = $self->_tables_list({ constraint => $self->constraint, exclude => $self->exclude }); + my @current = $self->_tables_list; foreach my $table (@current) { if(!exists $self->_tables->{$table->sql_name}) { diff --git a/lib/DBIx/Class/Schema/Loader/DBI.pm b/lib/DBIx/Class/Schema/Loader/DBI.pm index e15793b..47e4248 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI.pm @@ -118,7 +118,7 @@ sub _supports_db_schema { 1 } # Returns an array of table objects sub _tables_list { - my ($self, $opts) = (shift, shift); + my ($self) = @_; my @tables; @@ -128,7 +128,7 @@ sub _tables_list { my $nns = qr/[^\Q$self->{name_sep}\E]/; foreach my $schema (@{ $self->db_schema || [undef] }) { - my @raw_table_names = $self->_dbh_tables($schema, @_); + my @raw_table_names = $self->_dbh_tables($schema); TABLE: foreach my $raw_table_name (@raw_table_names) { my $quoted = $raw_table_name =~ /^$qt/; @@ -189,7 +189,7 @@ sub _tables_list { } } - return $self->_filter_tables(\@tables, $opts); + return $self->_filter_tables(\@tables); } sub _recurse_constraint { @@ -228,14 +228,13 @@ sub _check_constraint { # apply constraint/exclude and ignore bad tables and views sub _filter_tables { - my ($self, $tables, $opts) = @_; + my ($self, $tables) = @_; my @tables = @$tables; my @filtered_tables; - $opts ||= {}; - @tables = _check_constraint(1, $opts->{constraint}, @tables); - @tables = _check_constraint(0, $opts->{exclude}, @tables); + @tables = _check_constraint(1, $self->constraint, @tables); + @tables = _check_constraint(0, $self->exclude, @tables); TABLE: for my $table (@tables) { try { diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Informix.pm b/lib/DBIx/Class/Schema/Loader/DBI/Informix.pm index 5dd07e1..7a58398 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Informix.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Informix.pm @@ -179,7 +179,7 @@ EOF } sub _tables_list { - my ($self, $opts) = @_; + my ($self) = @_; my @tables; @@ -204,7 +204,7 @@ EOF } } - return $self->_filter_tables(\@tables, $opts); + return $self->_filter_tables(\@tables); } sub _constraints_for { diff --git a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm index 78e553d..10093ca 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm @@ -234,7 +234,7 @@ EOF } sub _tables_list { - my ($self, $opts) = @_; + my ($self) = @_; my @tables; @@ -259,7 +259,7 @@ EOF } } - return $self->_filter_tables(\@tables, $opts); + return $self->_filter_tables(\@tables); } sub _table_pk_info { diff --git a/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm b/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm index af11015..87934c9 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/SQLAnywhere.pm @@ -48,7 +48,7 @@ sub _setup { } sub _tables_list { - my ($self, $opts) = @_; + my ($self) = @_; my @tables; @@ -73,7 +73,7 @@ EOF } } - return $self->_filter_tables(\@tables, $opts); + return $self->_filter_tables(\@tables); } sub _columns_info_for { diff --git a/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm b/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm index c723f5e..07ddc61 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm @@ -230,7 +230,7 @@ sub _table_uniq_info { } sub _tables_list { - my ($self, $opts) = @_; + my ($self) = @_; my $sth = $self->dbh->prepare("SELECT * FROM sqlite_master"); $sth->execute; @@ -248,7 +248,7 @@ sub _tables_list { ); } $sth->finish; - return $self->_filter_tables(\@tables, $opts); + return $self->_filter_tables(\@tables); } sub _table_info_matches { diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm b/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm index f58ae0d..349884b 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm @@ -140,7 +140,7 @@ EOF } sub _tables_list { - my ($self, $opts) = @_; + my ($self) = @_; my @tables; @@ -168,7 +168,7 @@ EOF } } - return $self->_filter_tables(\@tables, $opts); + return $self->_filter_tables(\@tables); } sub _uid {